jQWidgets Forums

jQuery UI Widgets Forums Grid Change url jqxgrid dynamically

This topic contains 1 reply, has 1 voice, and was last updated by  ngchagas 5 years, 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Change url jqxgrid dynamically #107414

    ngchagas
    Participant

    Hi,
    How do I change the url of object source dynamically and reload data ?
    The p1 indicates which records must be load.
    Something like this:




    var theme = ‘office’;
    var url1 = “api.php?p1=0”;
    var source =
    {
    datatype: “json”,
    type: “POST”,
    datafields: [
    {name: ‘data_pedido’, type: ‘date’},
    {name: ‘status’, type: ‘string’},
    {name: ‘status2’, type: ‘string’},
    {name: ‘valor’, type: ‘float’},
    {name: ‘hora’, type: ‘string’},
    {name: ‘contra_vista’, type: ‘float’},
    {name: ‘contra_parcelado’, type: ‘float’}
    ],
    url: url1
    };

    var dataAdapter = new $.jqx.dataAdapter(source, {
    loadComplete: function (data) {
    }
    });


    $(‘#chk’).click(function () {
    if(url1==”api.php?p1=1″){
    url1 = “api.php?p1=0”;
    }
    else {
    url1 = “api.php?p1=1”;
    }
    source.source = url1;
    var dataAdapter = new $.jqx.dataAdapter(source);
    $(“#jqxgrid”).jqxGrid({ source: dataAdapter });
    $(“#jqxgrid”).jqxGrid(‘updatebounddata’, ‘cells’);
    });

    Regards Nilton

    Change url jqxgrid dynamically #107427

    ngchagas
    Participant

    I got it.
    Just change source.source = url1 ==> source.url = url1;

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

You must be logged in to reply to this topic.