jQWidgets Forums

jQuery UI Widgets Forums Grid Using filterRow with dynamic data

This topic contains 13 replies, has 4 voices, and was last updated by  Peter Stoev 11 years, 2 months ago.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
  • Using filterRow with dynamic data #8066

    slodge
    Member

    Is there any way I can use showfilterrow with dynamic data – e.g. with data updated over a json web service.

    Currently when I try to use the filterrow, the table gets corrupted when the data is updated – especially I get the filterrow displayed above the header row – like in:

    To achieve this effect, try adjusting the sample: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/filterrow.htm

    with the additional lines:


    var changeData = function() {
    data = generatedata(500);
    dataAdapter.dataBind();
    };
    setInterval(changeData, 5000);

    This causes the lines switching to occur.

    Any suggestions welcome 🙂

    Stuart

    Using filterRow with dynamic data #8068

    slodge
    Member

    and then I tried updating to 2.4.2…

    … and you’ve already fixed it 🙂

    THANKS 🙂 🙂 🙂

    Using filterRow with dynamic data #8069

    slodge
    Member

    … actually, not quite working still ….

    If I change the data, then I don’t think my ‘filterlist’ gets updated correctly.

    e.g. if I use code like:


    var changeData = function() {
    for (var i in data)
    data[i].productname = '1' + data[i].productname;
    dataAdapter.dataBind();
    };
    setInterval(changeData, 5000);

    then after data update the filterlist for product continues to show “Black Tea”, “Green Tea”, “Caffe Espresso”, etc and not “1Black Tea”, “1Green Tea”, “1Caffe Espresso”, etc.

    Is there an easy way to force the filter list to update?

    Stuart

    Using filterRow with dynamic data #8070

    Peter Stoev
    Keymaster

    Hi slodge,

    In order to update the data displayed in an existing Grid, you need to create a new source object or update your existing one, then create a new jqxDataAdapter, and finally set the Grid’s source property to point to the new instance of jqxDataAdapter.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Using filterRow with dynamic data #8073

    slodge
    Member

    Thanks Peter

    In my real code, I’m updating the data using json and asking the data adapter to databind.

    The grid is updating correctly, but the filterlist doesn’t change.

    e.g. if I adjust the sample to:


    var changeData = function() {
    for (var i in data)
    data[i].productname = '1' + data[i].productname;
    var newSource = {
    localdata: data,
    datatype: "array"
    };
    var newDataAdapter = new $.jqx.dataAdapter(newSource);
    $("#jqxgrid").jqxGrid('source', newDataAdapter);
    };
    setInterval(changeData, 5000);

    which I think is: create a new source object, then create a new jqxDataAdapter, and set the Grid’s source property to point to the new jqxDataAdapter?

    then I see the filter list look like:

    I’ve tried calling clearfilters too – but I think I need to do something else?

    Stuart

    Using filterRow with dynamic data #8085

    Peter Stoev
    Keymaster

    Hi Stuart,

    Thanks for the valuable feedback! We’ll investigate the reported behavior and I also created a new work item about it.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Using filterRow with dynamic data #9601

    Glen Edwards
    Participant

    I have a very similar situation to this except I am using a knockout bound data source.

    It’s a great feature but if I can’t get the list to update it is worthless. From the above conversation I am not sure it refreshing the list is possible. I have tried to hook into the bindComplete event but without any luck.

    Using filterRow with dynamic data #9603

    Peter Stoev
    Keymaster

    Hi Glen,

    There’s no ‘bindComplete’ event in jqxGrid and the issue here was that the filter row’s dropdown is not updated.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Using filterRow with dynamic data #9696

    Glen Edwards
    Participant

    Hi Peter

    Sorry I mistyped -it was the ‘binding complete’ which I found in your documentation

    Code example
    Bind to the bindingcomplete event by type: jqxGrid.
    $("#jqxgrid").bind("bindingcomplete", function (event) {
    // your code here.
    });

    I am having the same issue as slodge except I have a knockout observablearray bound to my grid which when updated does not affect the filter dropdown

    Using filterRow with dynamic data #9698

    Peter Stoev
    Keymaster

    Hi Glen,

    In jQWidgets 2.5, when the Grid’s data source is updated, the filter dropdowns are updated, too. If you are still having this issue, check whether you use the latest version or if you are using it, post your code so we can’t test it.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Using filterRow with dynamic data #48184

    amit.dhall4
    Participant

    Hi, I read the post and I am stuck with similar kind of problem. I am having dynamic data coming into the JQXGrid and I am trying to use filter along but It just crashes as new data comes IN. I am using jQWidgets v3.0.2 (2013-August-26).

    Thanks
    Amit

    Using filterRow with dynamic data #48189

    Peter Stoev
    Keymaster

    Hi Amit,

    If you still reproduce your issue with jQWidgets ver. 3.1, send us a sample and we will test what goes wrong locally.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Using filterRow with dynamic data #48199

    amit.dhall4
    Participant

    Hi Peter,
    I have moved on to JQWidgets 3.1, but I am still getting the same issue, I am a new bee I might be doing something wrong.
    I am using the methods beginUpdate() and endUpdate(). Can you share a small code snippet for same with some guidance on the same.
    Thanks
    Amit

    Using filterRow with dynamic data #48200

    Peter Stoev
    Keymaster

    Hi Amit,

    You can send us your erroneous scenario and we will test it locally.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.