jQuery UI Widgets Forums Grid change local data

This topic contains 1 reply, has 2 voices, and was last updated by  Dimitar 9 years, 11 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • change local data #64513

    rahisarm
    Participant

    Hello team..
    As im working with the jqxgrid,i need to change the local data…In the grid im able to fetch the data from the server side using ajax…
    but what i need is that based on a condition i need to change the local data…can you just put me some sample codes..
    To make myself clearer..What i need is that..
    if(document.getElementById(“Docno”).value!=”){
    group2=ajaxresult;
    }
    else{
    some other data
    }
    var source =
    {
    datatype: “json”,
    datafields: [
    {name : ‘gid’ , type: ‘string’ }
    ],
    localdata: group2,

    };

    change local data #64530

    Dimitar
    Participant

    Hello rahisarm,

    You do not have to redefine the source, just update its localdata. Here is an example of what you would have to do:

    var group2;
    
    if (document.getElementById("Docno").value != '') {
        group2 = ajaxresult;
    } else {
        group2 = ajaxresult2;
    }
    
    source.localdata = group2;
    
    dataAdapter.dataBind();
    
    $('#jqxGrid').jqxGrid('updatebounddata');

    Best Regards,
    Dimitar

    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.