jQWidgets Forums

jQuery UI Widgets Forums Grid Editable date column with min and max

This topic contains 3 replies, has 2 voices, and was last updated by  Peter Stoev 8 years, 5 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Editable date column with min and max #90570

    stlredlink
    Participant

    Hello,

    we use a editable date column with a min and max date specified – see http://jsfiddle.net/fgn56tj8/2/. When the cell is empty and you click on the datepicker icon than the datepicker shows the current month. The problem is that min and max date are not lying within the current month. We would expect that the month that matches the min date would be shown by default. To make matters worse we can’t even change the month in the datepicker.

    Any ideas how to solve that problem?

    Best regards

    Editable date column with min and max #90589

    Peter Stoev
    Keymaster

    Hi stiredlink,

    You can implement the initeditor and set the DateTimeInput Grid editor’s value.

    Example:

    
      var datafields = [
                        {name: 'id', type: 'number'},
                        {name: 'start', type: 'date'},
                        {name: 'name', type: 'string'}
                    ],
                    source =
                    {
                        localdata: [
                            {id: 1, start: '', name: 'Unit-A'},
                            {id: 2, start: '2015-01-01', name: 'Unit-B'},
                            {id: 3, start: '2017-01-01', name: 'Unit-C'},
                            {id: 4, start: '2016-01-01', name: 'Unit-D'}
                        ],
                        datatype: 'array',
                        datafields: datafields,
                        id: 'id'
                    },
                    dataAdapter = new $.jqx.dataAdapter(source);
    
                $('#jqxgrid').jqxGrid(
                    {
                        width: 600,
                        autoheight: true,
                        source: dataAdapter,
                        sortable: true,
                        editable: true,
                        columns: [
                            {text: 'ID', datafield: 'id', hidden: true},
                            {
                                text: 'Start',
                                datafield: 'start',
                                width: 120,
                                cellsformat: 'dd.MM.yyyy',
                                columntype: 'datetimeinput',
                                createeditor: function (rowIndex, cellValue, editor) {
                                    editor.jqxDateTimeInput({min: new Date(2017, 4, 17), max: new Date(2017, 4, 23)});
                                },
                                initeditor: function(rowindex, cellvalue, editor) {
        editor.jqxDateTimeInput({value: new Date(2017, 4, 17)});                         
                                }
                            },
                            {text: 'Name', datafield: 'name'}
                        ]
                    }
                );

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    Editable date column with min and max #90827

    stlredlink
    Participant

    Hi Peter,

    well, yes that would work but seems more like a workaround for an obvious bug.

    Problem with this workaround is is that e.g. an user maybe accidentally clicks on such an editable date column and than a date will be inserted although it wasn’t users intention.

    Best regards

    Editable date column with min and max #90833

    Peter Stoev
    Keymaster

    Hi stlredlink,

    Thank you for your opinion. We will take it into consideration.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.