jQWidgets Forums

jQuery UI Widgets Forums Grid Kindly help jqx filterable feature is not working with virtual paging.

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 12 years, 7 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • Zafar
    Member

    Hello All,

    I just modified virtual data paging to include filterable feature. But it doesn’t filer if I enter anything in filter textboxes below each column.

    Could you kindly help me fix this please? Below is my code.

    Thanks so much!

    $(document).ready(function () {
    $(document).ready(function () {
    // prepare the data
    var data = new Array();
    var jsonObject = { “contactList”:[
    {“age”:1,”SId”:”S1234567″,”gender”:”male”},
    {“age”:1,”SId”:”S1234567″,”gender”:”male”},

    ], “totalrecords”:2};
    var generatedata = function (startindex, endindex) {
    var data = {};
    for (var i = startindex; i < endindex; i++) {
    var row = {};
    if (jsonObject.contactList[i]) {
    row["age"] = jsonObject.contactList[i].age;
    row["gender"] = jsonObject.contactList[i].gender;
    row["SId"] = jsonObject.contactList[i].SId;
    }
    data[i] = row;
    }
    return data;
    }
    var source =
    {
    datatype: "array",
    localdata: {},
    totalrecords: jsonObject.totalrecords
    };
    // load virtual data.
    var rendergridrows = function (params) {
    var data = generatedata(params.startindex, params.endindex);
    return data;
    }
    var totalcolumnrenderer = function (row, column, cellvalue) {
    var cellvalue = $.jqx.dataFormat.formatnumber(cellvalue, 'c2');
    return '‘ + cellvalue + ”;
    }
    var dataAdapter = new $.jqx.dataAdapter(source);
    $(“#jqxgrid”).jqxGrid(
    {
    width: 670,
    autoheight: true,
    source: dataAdapter,
    virtualmode: true,
    pageable: true,
    showfilterrow: true,
    filterable: true,
    rendergridrows: rendergridrows,
    columns: [
    { text: ‘Age’, datafield: ‘age’, width: 50 },
    { text: ‘SId’, datafield: ‘SId’, width: 120 },
    { text: ‘Gender’, datafield: ‘gender’, width: 80 },
    ]
    });
    });
    });


    Peter Stoev
    Keymaster

    Hi Zafar,

    In virtual mode, the Grid’s data is loaded on demand in the Grid, so the local filtering will not work as there are records only in the view. See this sample for filtering implementation in virtual mode: serverfiltering_paging_and_sorting.htm.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.