jQWidgets Forums

jQuery UI Widgets Forums Grid Date Filter not working

This topic contains 14 replies, has 3 voices, and was last updated by  Peter Stoev 10 years, 3 months ago.

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
  • Date Filter not working #64253

    letos07
    Participant

    Hey, Guys!

    In datafields I write : { name: 'UpdateDate',type:'date',format:'D' },"
    In columns : { text: 'Последнее изменение',datafield:'UpdateDate',columntype: 'datetimeinput',cellsrenderer: cellsrendererLastUpdate,filtertype:'date',cellsformat:'D'},

    And when I tried date filter on this column – the filtering is working, but i dont see the date which I select on datepicker.
    I see it after second filter this date column

    Date Filter not working #64258

    Nadezhda
    Participant

    Hello letos07,

    Please, take a look at the following example: http://jsfiddle.net/mLvp78rn/. If it does not help you resolve your issue, please provide us with more information or a sample code.

    Best Regards,
    Nadezhda

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

    Date Filter not working #64264

    letos07
    Participant

    No, i am using showfilterrow: true

    Date Filter not working #64289

    Nadezhda
    Participant

    Hi letos07,

    Here is an example with ‘showfilterrow’ property set to true and works on our side: http://jsfiddle.net/t5bhm33v/.

    Best Regards,
    Nadezhda

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

    Date Filter not working #65558

    letos07
    Participant

    maybe my problem is I using grid in virtual mode?
    The filter request is send successfully and grid render new data good,
    and the filter information is good ($(‘#jqxgrid’).jqxGrid(‘getfilterinformation’))
    but i dont see date filter text in filterrow(

    Date Filter not working #65585

    Nadezhda
    Participant

    Hi letos07,

    When ‘virtualmode’ is true, a different filter logic has to be implemented. Please refer to the PHP demo Grid Server Filtering to learn what approach you should take.

    Best Regards,
    Nadezhda

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

    Date Filter not working #65632

    letos07
    Participant

    first of all in link which you send me i see only grid and nothing documentation about virtualmode.
    And my asp.net server filter worked correctly, and grid rows are in color when i use datefilter, but i DONT see datetime which i selected before, the datetime filter row is EMPTY

    Date Filter not working #65653

    Nadezhda
    Participant

    Hi letos07,

    If you are set ‘virtualmode’ to true, please refer to the PHP demo Grid Server Sorting, Paging and Filtering.

    Do you have this issue if ‘virtualmode’ is set to false? If filter row is still empty when ‘virtualmode’ is set to false, please share a code sample or a JSFiddle example so we can determine the source of the issue.

    Best Regards,
    Nadezhda

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

    Date Filter not working #65665

    letos07
    Participant
    <script type="text/javascript">
        $(document).ready(function () {
            // prepare the data
    
            var source =
            {
                id: 'Id',
                datatype: "json",
                url: "http://localhost:50126/Service/GetGridData?table=" + "Posada",
                datafields: [
    
    { name: 'Name',type:'string'},{ name: 'Description',type:'string'},{ name: 'isdeleted',type:'bool'},
                     { name: 'UpdateDate',type:'date',format:'D' },{ name: 'LastUpdate'},                            ],
                root: "data",
                beforeprocessing: function (resp) {
                    if (resp['result'] == true) {
                        var returnData = {};
                        returnData.totalrecords = resp.data['total'];
                        returnData.records = resp.data.items;
                        return returnData;
                    }
                    else {
                        site.ErrorEvent(resp['error']);
                        return [];
                    }
    
                },
                filter: function () {
                    $("#jqxgrid_" + 'Posada').jqxGrid('updatebounddata', 'filter');
                },
                sort: function () {
                    $("#jqxgrid_" + 'Posada').jqxGrid('updatebounddata', 'sort');
                }
                
    
            };
            var dataAdapter = new $.jqx.dataAdapter(source, {
                loadComplete: function (data) { },
                loadError: function (ex, status, error) {
                    if (ex.status != 567) { site.ErrorEvent(JSON.parse(ex.responseText)['error']); }
                    else { site.GetRedirect(ex); }
                }
            });
            var cellsrendererLastUpdate = function (row, columnfield, value, defaulthtml, columnproperties) {
                var data = $("#jqxgrid_" + 'Posada').jqxGrid('getrowdata', row);
                if (data != undefined) {
                    var lastupdate = '<img align="left" class="status-user-JSVarUserId" width="20" height="20" alt="статус" src="/Home/ThumbnailAvatars/JSVarUserAvatar" /> <div><span>JSVarUserName,</span> <span>JSVarDate</span></div>';
    
                    return "<div style='text-overflow: ellipsis; overflow: hidden;text-align:center;margin-top:10px;'>" + lastupdate.replace("JSVarUserId", data.LastUpdate.UserLastUpdateId).replace("JSVarUserAvatar", data.LastUpdate.AvatarFileName).replace("JSVarUserName", data.LastUpdate.FullNameInitials)
                        .replace("JSVarDate", Format(data.UpdateDate)).replace("JSVarUserName", value) + "</div>";
                }
                else return "";
            };
            function Format(date) {
                //var d = new Date(parseInt(date.substr(6)));
                var d = new Date(date);
                var options = {
                    weekday: "long", year: "numeric", month: "short",
                    day: "numeric", hour: "2-digit", minute: "2-digit"
                };
                return d.toLocaleString('ru',options);
            }
            
    
            $("#jqxgrid_" + 'Posada').jqxGrid(
                    {
                        width: '92%',
                        showdefaultloadelement: false,
                        height: 500,
                        columnsheight: 50,
                        rowsheight: 40,
                        autorowheight: true,
                        columnsresize: true,
                        enabletooltips: true,
                        showfilterrow: true,
                        filterable: true,
                        sortable: true,
                        pageable: true,
                        scrollmode: 'logical',
                        theme: "metro",
                        enablebrowserselection: true,
                        pagesize: 20,
                        pagesizeoptions: [10, 20, 40, 80],
                        virtualmode: true,
                        rendergridrows: function () {
                            return dataAdapter.records;
                        },
                        autoshowfiltericon: false,
                        localization: getLocalization(),
                        source: dataAdapter,
                        columns: [
    {text: 'Название', datafield: 'Name',sortable: true,filterable: true,align:'center',cellsalign:'center',},{text: 'Описание', datafield: 'Description',sortable: true,filterable: true,align:'center',cellsalign:'center',},{text: 'Удален', datafield: 'isdeleted',sortable: false,filterable: false,align:'center',cellsalign:'center',},                                        {width:200,text: 'Последнее изменение',datafield:'UpdateDate',align:'center',cellsrenderer: cellsrendererLastUpdate,filtertype:'range',cellsformat:'D'}         ]
                    });
    
            $("#jqxgrid_Posada").on("bindingcomplete", function (event) {
                console.log('Posada' + ' binding complete');
    $('#jqxgrid_Posada').jqxGrid('hidecolumn', 'isdeleted');                                    //if (Model.Columns.Count>6)
                        });
            $('#clearfilteringbutton_Posada').jqxButton({ height: 25, theme: "metro" });
            $('#clearfilteringbutton_Posada').click(function () {
                $("#jqxgrid_Posada").jqxGrid('clearfilters');
            });
    
            
                $('#isdeleted_Posada').jqxCheckBox({ width: 120, height: 25, theme: "metro", rtl: true, checked: 'False' == 'True' ? true : false });
                $('#isdeleted_Posada').bind('change', function (event) {
                    $.ajax({
                        url: 'http://localhost:50126/Service/ChangeIncludeDeleted?state=' + event.args.checked + '&table=Posada',
                        type: "PUT",
                        success: function (resp) {
                            debugger
                            if (resp['result'] == true) {
                                site.UpdateGrid('Posada');
                            }
                            else site.ErrorEvent(resp['error']);
    
                        },
                        error: function (ex, a2) {
                            site.ErrorEvent(JSON.parse(ex.responseText)['error']);
                        },
                    })
                });
            
            
            
                $("#excelExport_Posada").jqxButton({ theme: 'metro' });
                $("#excelExport_Posada").click(function () {
                    
                    $("#jqxgrid_Posada").jqxGrid('exportdata', 'xls', 'Posada');
                   
                });
            
            
                $("#print_Posada").jqxButton({ theme: 'metro' });
                $("#print_Posada").click(function () {
                    var gridContent = $("#jqxgrid_Posada").jqxGrid('exportdata', 'html');
                    var newWindow = window.open('', '', 'width=800, height=500'),
                    document = newWindow.document.open(),
                    pageContent =
                        '<!DOCTYPE html>\n' +
                        '<html>\n' +
                        '<head>\n' +
                        '<meta charset="utf-8" />\n' +
                        '<title>.Um Consult</title>\n' +
                        '</head>\n' +
                        '<body>\n' + gridContent + '\n</body>\n</html>';
                    document.write(pageContent);
                    document.close();
                    newWindow.print();
                });
            
        });
    </script>

    JSON
    {"result":true,"data":{"items":[{"Id":5139,"UpdateByUserId":1,"UpdateDate":"\/Date(1419374055273)\/","Name":"HNZQFLaaAd","Description":"cJCMv26Gm7","isdeleted":false,"LastUpdate":{"UserLastUpdateId":1,"FullNameInitials":"Куниц А.В","ConectionId":"cb217741-8605-4e28-807f-879f2d97f4d5;8b452865-687b-4403-9164-8838add8f4fb;4c03095e-6514-4642-8fd8-161bad86db2d","AvatarFileName":"avatar008_b90d0b795b9f4e9a827aba595392277b.jpg"}},{"Id":5138,"UpdateByUserId":1,"UpdateDate":"\/Date(1419373762863)\/","Name":"OJ9d1Dcvln","Description":"S37wNg1bF2","isdeleted":false,"LastUpdate":{"UserLastUpdateId":1,"FullNameInitials":"Куниц А.В","ConectionId":"cb217741-8605-4e28-807f-879f2d97f4d5;8b452865-687b-4403-9164-8838add8f4fb;4c03095e-6514-4642-8fd8-161bad86db2d","AvatarFileName":"avatar008_b90d0b795b9f4e9a827aba595392277b.jpg"}},{"Id":5137,"UpdateByUserId":1,"UpdateDate":"\/Date(1419373420603)\/","Name":"ibHIC3FPZN","Description":"hK2yXsknCU","isdeleted":false,"LastUpdate":{"UserLastUpdateId":1,"FullNameInitials":"Куниц А.В","ConectionId":"cb217741-8605-4e28-807f-879f2d97f4d5;8b452865-687b-4403-9164-8838add8f4fb;4c03095e-6514-4642-8fd8-161bad86db2d","AvatarFileName":"avatar008_b90d0b795b9f4e9a827aba595392277b.jpg"}},{"Id":5136,"UpdateByUserId":1,"UpdateDate":"\/Date(1419373301683)\/","Name":"elrfZsnPyu","Description":"oHOOLGoBT6","isdeleted":false,"LastUpdate":{"UserLastUpdateId":1,"FullNameInitials":"Куниц А.В","ConectionId":"cb217741-8605-4e28-807f-879f2d97f4d5;8b452865-687b-4403-9164-8838add8f4fb;4c03095e-6514-4642-8fd8-161bad86db2d","AvatarFileName":"avatar008_b90d0b795b9f4e9a827aba595392277b.jpg"}},{"Id":5135,"UpdateByUserId":1,"UpdateDate":"\/Date(1419372974477)\/","Name":"gKL9CzYSr9","Description":"AJekQJ2zCk","isdeleted":false,"LastUpdate":{"UserLastUpdateId":1,"FullNameInitials":"Куниц А.В","ConectionId":"cb217741-8605-4e28-807f-879f2d97f4d5;8b452865-687b-4403-9164-8838add8f4fb;4c03095e-6514-4642-8fd8-161bad86db2d","AvatarFileName":"avatar008_b90d0b795b9f4e9a827aba595392277b.jpg"}},{"Id":5134,"UpdateByUserId":1,"UpdateDate":"\/Date(1419372876740)\/","Name":"vJcPITT2gt","Description":"qIVsc6P6XI","isdeleted":false,"LastUpdate":{"UserLastUpdateId":1,"FullNameInitials":"Куниц А.В","ConectionId":"cb217741-8605-4e28-807f-879f2d97f4d5;8b452865-687b-4403-9164-8838add8f4fb;4c03095e-6514-4642-8fd8-161bad86db2d","AvatarFileName":"avatar008_b90d0b795b9f4e9a827aba595392277b.jpg"}},{"Id":5133,"UpdateByUserId":1,"UpdateDate":"\/Date(1419372760997)\/","Name":"AI3n8STYPW","Description":"bAMYm5vetd","isdeleted":false,"LastUpdate":{"UserLastUpdateId":1,"FullNameInitials":"Куниц А.В","ConectionId":"cb217741-8605-4e28-807f-879f2d97f4d5;8b452865-687b-4403-9164-8838add8f4fb;4c03095e-6514-4642-8fd8-161bad86db2d","AvatarFileName":"avatar008_b90d0b795b9f4e9a827aba595392277b.jpg"}},{"Id":5132,"UpdateByUserId":1,"UpdateDate":"\/Date(1419372681213)\/","Name":"rO22Rzjagr","Description":"FrSl2i0ntf","isdeleted":false,"LastUpdate":{"UserLastUpdateId":1,"FullNameInitials":"Куниц А.В","ConectionId":"cb217741-8605-4e28-807f-879f2d97f4d5;8b452865-687b-4403-9164-8838add8f4fb;4c03095e-6514-4642-8fd8-161bad86db2d","AvatarFileName":"avatar008_b90d0b795b9f4e9a827aba595392277b.jpg"}},{"Id":5129,"UpdateByUserId":1,"UpdateDate":"\/Date(1419368187980)\/","Name":"brCeNGdCZ0","Description":"S5TOu1pmHw","isdeleted":false,"LastUpdate":{"UserLastUpdateId":1,"FullNameInitials":"Куниц А.В","ConectionId":"cb217741-8605-4e28-807f-879f2d97f4d5;8b452865-687b-4403-9164-8838add8f4fb;4c03095e-6514-4642-8fd8-161bad86db2d","AvatarFileName":"avatar008_b90d0b795b9f4e9a827aba595392277b.jpg"}},{"Id":5128,"UpdateByUserId":1,"UpdateDate":"\/Date(1419368092010)\/","Name":"VrJHOdzQ4y","Description":"7mx7SU8Lcg","isdeleted":false,"LastUpdate":{"UserLastUpdateId":1,"FullNameInitials":"Куниц А.В","ConectionId":"cb217741-8605-4e28-807f-879f2d97f4d5;8b452865-687b-4403-9164-8838add8f4fb;4c03095e-6514-4642-8fd8-161bad86db2d","AvatarFileName":"avatar008_b90d0b795b9f4e9a827aba595392277b.jpg"}},{"Id":5127,"UpdateByUserId":1,"UpdateDate":"\/Date(1419368015070)\/","Name":"ZzCBMEp7zj","Description":"4lV48iZvGZ","isdeleted":false,"LastUpdate":{"UserLastUpdateId":1,"FullNameInitials":"Куниц А.В","ConectionId":"cb217741-8605-4e28-807f-879f2d97f4d5;8b452865-687b-4403-9164-8838add8f4fb;4c03095e-6514-4642-8fd8-161bad86db2d","AvatarFileName":"avatar008_b90d0b795b9f4e9a827aba595392277b.jpg"}},{"Id":5126,"UpdateByUserId":1,"UpdateDate":"\/Date(1419367969847)\/","Name":"yhiUJda07s","Description":"9SyzPII1nZ","isdeleted":false,"LastUpdate":{"UserLastUpdateId":1,"FullNameInitials":"Куниц А.В","ConectionId":"cb217741-8605-4e28-807f-879f2d97f4d5;8b452865-687b-4403-9164-8838add8f4fb;4c03095e-6514-4642-8fd8-161bad86db2d","AvatarFileName":"avatar008_b90d0b795b9f4e9a827aba595392277b.jpg"}},{"Id":5125,"UpdateByUserId":1,"UpdateDate":"\/Date(1419367926440)\/","Name":"4vwiIjpjOz","Description":"r2W8cfWgzx","isdeleted":false,"LastUpdate":{"UserLastUpdateId":1,"FullNameInitials":"Куниц А.В","ConectionId":"cb217741-8605-4e28-807f-879f2d97f4d5;8b452865-687b-4403-9164-8838add8f4fb;4c03095e-6514-4642-8fd8-161bad86db2d","AvatarFileName":"avatar008_b90d0b795b9f4e9a827aba595392277b.jpg"}},{"Id":5124,"UpdateByUserId":1,"UpdateDate":"\/Date(1419367895497)\/","Name":"aip4Q3Msbg","Description":"MrqH2fUw3O","isdeleted":false,"LastUpdate":{"UserLastUpdateId":1,"FullNameInitials":"Куниц А.В","ConectionId":"cb217741-8605-4e28-807f-879f2d97f4d5;8b452865-687b-4403-9164-8838add8f4fb;4c03095e-6514-4642-8fd8-161bad86db2d","AvatarFileName":"avatar008_b90d0b795b9f4e9a827aba595392277b.jpg"}},{"Id":5123,"UpdateByUserId":1,"UpdateDate":"\/Date(1419367560510)\/","Name":"MOWiN6qSbW","Description":"Ok1yZhleem","isdeleted":false,"LastUpdate":{"UserLastUpdateId":1,"FullNameInitials":"Куниц А.В","ConectionId":"cb217741-8605-4e28-807f-879f2d97f4d5;8b452865-687b-4403-9164-8838add8f4fb;4c03095e-6514-4642-8fd8-161bad86db2d","AvatarFileName":"avatar008_b90d0b795b9f4e9a827aba595392277b.jpg"}},{"Id":5122,"UpdateByUserId":1,"UpdateDate":"\/Date(1419367436743)\/","Name":"pb5w9K7YNa","Description":"O6qhu58XxA","isdeleted":false,"LastUpdate":{"UserLastUpdateId":1,"FullNameInitials":"Куниц А.В","ConectionId":"cb217741-8605-4e28-807f-879f2d97f4d5;8b452865-687b-4403-9164-8838add8f4fb;4c03095e-6514-4642-8fd8-161bad86db2d","AvatarFileName":"avatar008_b90d0b795b9f4e9a827aba595392277b.jpg"}},{"Id":5121,"UpdateByUserId":1,"UpdateDate":"\/Date(1419367403750)\/","Name":"GrD4eaYMot","Description":"rDuufbMlWs","isdeleted":false,"LastUpdate":{"UserLastUpdateId":1,"FullNameInitials":"Куниц А.В","ConectionId":"cb217741-8605-4e28-807f-879f2d97f4d5;8b452865-687b-4403-9164-8838add8f4fb;4c03095e-6514-4642-8fd8-161bad86db2d","AvatarFileName":"avatar008_b90d0b795b9f4e9a827aba595392277b.jpg"}},{"Id":5120,"UpdateByUserId":1,"UpdateDate":"\/Date(1419367347390)\/","Name":"lrQhysGLro","Description":"CXX3YcwPRT","isdeleted":false,"LastUpdate":{"UserLastUpdateId":1,"FullNameInitials":"Куниц А.В","ConectionId":"cb217741-8605-4e28-807f-879f2d97f4d5;8b452865-687b-4403-9164-8838add8f4fb;4c03095e-6514-4642-8fd8-161bad86db2d","AvatarFileName":"avatar008_b90d0b795b9f4e9a827aba595392277b.jpg"}},{"Id":5119,"UpdateByUserId":1,"UpdateDate":"\/Date(1419367201920)\/","Name":"6ndoVf0NIH","Description":"rXQ6WGrdZE","isdeleted":false,"LastUpdate":{"UserLastUpdateId":1,"FullNameInitials":"Куниц А.В","ConectionId":"cb217741-8605-4e28-807f-879f2d97f4d5;8b452865-687b-4403-9164-8838add8f4fb;4c03095e-6514-4642-8fd8-161bad86db2d","AvatarFileName":"avatar008_b90d0b795b9f4e9a827aba595392277b.jpg"}},{"Id":5118,"UpdateByUserId":1,"UpdateDate":"\/Date(1419367154337)\/","Name":"ZcDOnwrup0","Description":"wTTld8DCWK","isdeleted":false,"LastUpdate":{"UserLastUpdateId":1,"FullNameInitials":"Куниц А.В","ConectionId":"cb217741-8605-4e28-807f-879f2d97f4d5;8b452865-687b-4403-9164-8838add8f4fb;4c03095e-6514-4642-8fd8-161bad86db2d","AvatarFileName":"avatar008_b90d0b795b9f4e9a827aba595392277b.jpg"}}],"total":75},"error":""}

    Date Filter not working #65685

    Nadezhda
    Participant

    Hi letos07,

    Could you, please, explain to us with more details so we can reproduce the issue: how do you select dates, do you have selected dates after selection and when the filter row is empty.

    Best Regards,
    Nadezhda

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

    Date Filter not working #65714

    letos07
    Participant

    hi Nadezhda!

    1.I select range of dates in your datepicker
    2. I doesnt see any dates in datepicker after first selection, but if i go to step 1 again i see selected dates in datepicker
    3. In both cases grid show successfully information, but i see the dates in datepicker only on second time

    Date Filter not working #65947

    letos07
    Participant

    Nadezhda, do you have any updates for me?

    Date Filter not working #65950

    Peter Stoev
    Keymaster

    Hey letos07,

    If you have server filtering enabled as I see in your code then refer to the PHP or .NET Demos which show how to implement filtering on your Server. You can’t filter data on the client side because the Data is loaded on demand.

    Best Regards,
    Peter Stoev

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

    Date Filter not working #66243

    letos07
    Participant

    Hi Peter!

    You dont understand me. My server filtering working fine on server side and client side.
    I dont show date filter which I choosed – what date I choose before filtering

    Date Filter not working #66269

    Peter Stoev
    Keymaster

    Hi letos07,

    yes, from your descriptions of the problem it seems that I don’t understand you and my colleagues, too. Would you please share jsfiddle.net sample which illustrates your issue?

    Best Regards,
    Peter Stoev

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

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

You must be logged in to reply to this topic.