[CLOSED] DateColumn issue on grid

  1. #1

    [CLOSED] DateColumn issue on grid

    Hello friends,

    We have another problem again. We are trying to make a grid which has a column with datepicker.
    What we need to implement is that column MonthDate to be a datefield which means it will have a datepicker, but we need that datepicker to be actually a MonthPicker like examples from js: https://docs.sencha.com/extjs/6.0.2/...ker.Month.html

    For example:
    In the current version of code anyhow we have tried to make that column formatting as "yyyyMM", we still cannot make it work on the editrow as:
    example: 202105; and the only format which works is: 19/05/2021.

    The thing is that as <ext-dateField> is working, see code below:
    <ext-dateField fieldLabel="<b>Month</b>" name="NewMonth"
                                       labelAlign="Left"
                                       allowBlank="false"
                                       Format="yyyyMM"
                                       id="Month"
                                       value='DateTime.Today.AddMonths(-1).ToString("yyyyMM")'
                                       maxDate="<%# DateTime.Today %>" />
    But as a <ext-dateColumn> or <ext-column> into <ext-gridPanel> is not working and we didnt find a solution to this.

    Can you please help us on this problem?


    Here is Code for the Grid:
    <ext-gridPanel title="Month Grid" id="monthgrid" header="false" frame="true" scrollable="true" minHeight="350">
        <store>
            <ext-store id="gridstore" data="Model.gridsmodel" autoLoad="true">
                <fields>
                    <ext-dateDataField  name="MonthDate" />
                    <ext-stringDataField name="Comment" />
                </fields>
            </ext-store>
        </store>
        <plugins>
            <ext-cellEditingPlugin clicksToEdit="1" editing="true" id="edit">
                <listeners>
                    <edit fn="edit" />
                </listeners>
            </ext-cellEditingPlugin>
        </plugins>
        <columns>
            <ext-dateColumn text="MonthDate" dataIndex="MonthDate" id="MonthDate" editor="datefield" Format="yyyyMM" value='DateTime.Today.ToString("yyyyMM")' maxDate="<%# DateTime.Today %>" />
            <ext-column text="Comment" id="Comment" dataIndex="Comment" flex="1" editor="textarea" />
        </columns>
    </ext-gridPanel>
    And here is a screenshot with example for the Month column where the first row is editable and how he needs the data, and the rest of them is an example of how we need the data. (the data is added thru sql for example)
    Click image for larger version. 

Name:	monthpicker.png 
Views:	12 
Size:	13.4 KB 
ID:	25529
    Last edited by fabricio.murta; May 25, 2021 at 4:22 PM.
  2. #2
    Hello @Retarian!

    Can you share the full test case you are trying (of course, the mock values can just come from a constant array instead of SQL). Without being able to reproduce your scenario and know which data is coming and going it is pretty difficult to give you advice on the problem you have.

    Looking forward to your follow-up.
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Sorry, we were in a hurry with that issue and we solved it using it in other way, for example:
    We have added a combobox editorModel in the column and defined it in the same file

    @{
        var MonthsComboBox = new ComboBox
        {
            DisplayField = "name",
            ValueField = "id",
            TypeAhead = true,
            QueryMode = "local",
            EmptyText = "Select a month...",
            Store = new Store
            {
                Data = DateMonthsData,
                Fields = new List<DataField>
    {
                    new DataField() { Name = "id" },
                    new DataField() { Name = "name" }
                }
            }
        };
    }@
    <ext-gridPanel title="Month Grid" id="monthgrid" header="false" frame="true" scrollable="true" minHeight="350">
        <store>
            <ext-store id="gridstore" data="Model.gridsmodel" autoLoad="true">
                <fields>
                    <ext-dateDataField  name="MonthDate" />
                    <ext-stringDataField name="Comment" />
                </fields>
            </ext-store>
        </store>
        <plugins>
            <ext-cellEditingPlugin clicksToEdit="1" editing="true" id="edit">
                <listeners>
                    <edit fn="edit" />
                </listeners>
            </ext-cellEditingPlugin>
        </plugins>
        <columns>
            <ext-column text="MonthDate" dataIndex="MonthDate" id="MonthDate" formatter="" editorModel="MonthsComboBox"/>
            <ext-column text="Comment" id="Comment" dataIndex="Comment" flex="1" editor="textarea" />
        </columns>
    </ext-gridPanel>
    And now is working.

    Really appreciate the response.
  4. #4
    Hello again, @Retarian!

    Glad you could find another solution that suits you and thanks for sharing it here in forums, we really appreciate it!

    When date time parsing and conversion is involved, it matters how data is coming from server and handled client-side, as they are treated as different data types, internally, so it is pretty tough to give you suggestions without a code involving the full lifecycle.

    We hope you understand. Keeping a test project or a copy of examples explorer project handy to experiment and draft test cases may prove really useful in the future.
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Ext.Net.DateColumn Format issue
    By lmueller in forum 1.x Help
    Replies: 4
    Last Post: Sep 17, 2018, 4:05 AM
  2. [CLOSED] How can set DateColumn value with Javascript inside grid?
    By arjunrvasisht in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 04, 2015, 2:18 PM
  3. [CLOSED] Datecolumn sort issue
    By CarWise in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Apr 02, 2014, 9:22 PM
  4. Replies: 1
    Last Post: Sep 19, 2013, 2:10 PM
  5. Grid with datecolumn
    By PetrSnobelt in forum 1.x Help
    Replies: 6
    Last Post: Sep 06, 2011, 12:47 PM

Tags for this Thread

Posting Permissions