jQuery UI Widgets Forums Grid clearfilters throw error "Uncaught TypeError: Cannot read property 'length' of u

This topic contains 2 replies, has 2 voices, and was last updated by  salah 9 years, 1 month ago.

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

  • salah
    Participant

    Hello Team,

    I knew this may be a silly question, but its giving me a lot of problem.

    I have a grid with filters true, and on a button click I am calling jqxgrid function clearfilters.

    When I click on button to clear the filters from the grid, sometimes it works fine, but most of the time it throws error in browser console stating “TypeError: Cannot read property ‘length’ of undefined'” and clearing of the filters doesn’t happen.

    This is how I am clearing the grid
    //
    $(‘#jqxCompanyGrid’).jqxGrid(‘clearfilters’);

    And here is the grid code
    //
    var source = {
    localdata: data.data,
    datatype: “array”,
    datafields: [{
    name: ‘company_id’,
    type: ‘int’
    }, {
    name: ‘company_name’,
    type: ‘string’
    }, {
    name: ‘cmp_country’,
    type: ‘string’
    }],
    id: ‘company_id’
    };

    var dataAdapter = new jQuery.jqx.dataAdapter(source);

    $(“#jqxCompanyGrid”).jqxGrid({
    width: “98.5%”,
    source: dataAdapter,
    filterable: true,
    pageable: true,
    height: “673px”,
    sortable: true,
    columnsreorder:true,
    height: 670,
    columnsHeight:34,
    pagerHeight:33,
    rowsheight: 24,
    pagesize: 25,
    pagesizeoptions: [’25’, ’50’, ’75’],
    columns: [{
    text: ‘ID’,
    datafield: ‘company_id’,
    width: “10%”,
    hidden: true
    }, {
    text: ‘Company Name’,
    filterable: true,
    datafield: ‘company_name’,
    width: “45%”
    }, {
    text: ‘Country’,
    filterable: true,
    datafield: ‘cmp_country’,
    width: “45%”
    }]
    });

    I am using jQWidgets v3.0.3


    Dimitar
    Participant

    Hello salah,

    Are you sure the grid is initialized by the time you call clearfilters? It does not seem so from your sample code. We also recommend using the latest release of jQWidgets (3.2.2). If the issue persists, please create a JSFiddle example, demonstrating the issue, and share it with us.

    Best Regards,
    Dimitar

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


    salah
    Participant

    well I updated jQWidgets to latest, but it didnt help me,

    I will try my best to create JSFiddle example and explain you guys, but till then you have any Idea why is it occurring?

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

You must be logged in to reply to this topic.