jQWidgets Forums

jQuery UI Widgets Forums Grid Refresh grid with $_POST data

This topic contains 2 replies, has 2 voices, and was last updated by  supun151515 7 years, 7 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Refresh grid with $_POST data #96552

    supun151515
    Participant

    Hi.. I am now using jqxgrid inside a function because I want to load variable data when needs to refresh.
    When I want to load the grid, I call
    ConsSub(‘somevalue’, ‘some_destination’);

    function ConsSub(owner, final_destination){  
                var theme = "";
    
                var data = "cons_sub.php";
                var source =
                {
                    datatype: "json",
                    datafields:
                    [
                        { name: 'ID' , type: 'number'},
                        { name: 'on_job_date', type: 'date'},
                        { name: 'yard_in_date', type: 'date'}                    
    
                    ],
                   id: 'ID',
                   url: data,
                   data:{owner:owner, final_destination:final_destination},
                   type:'POST'
                };
                var adapter = new $.jqx.dataAdapter(source);
    
                $("#jqxgrid").jqxGrid(
                {
                    width: 1305,
                    source: adapter,
                    theme: theme,
                    altrows: true,
                    groupable: true,
                    filterable: true,
                    columnsresize: true,
                    sortable: true,
                    autoheight: true,
                    columnsreorder: true,
                    //autorowheight: true,
                    showfilterrow: true,
                    ready: function () {
                      //addfilter();
                    },
                    autoshowfiltericon: true,
                    columns: [
                      {
                          text: '#', sortable: false, filterable: false, editable: false,
                          groupable: false, draggable: false, resizable: false,
                          datafield: '', columntype: 'number', width: 30,
                          cellsrenderer: function (row, column, value) {
                              return "<div style='margin:4px;'>" + (value + 1) + "</div>";
                          }
                      },
                      { text: 'On Job Date', datafield: 'on_job_date', cellsformat: 'yyyy-MM-dd', width: 90, cellsalign: 'center', align: 'center' },
                      { text: 'Yard in Date', datafield: 'yard_in_date', cellsformat: 'yyyy-MM-dd', width: 90, cellsalign: 'center', align: 'center', minwidth: 30 }
                    ]
                     
                });
    }

    Please guide me to prevent grid loads for multiple times.

    Thank You,
    Supun Silva

    Refresh grid with $_POST data #96569

    Hristo
    Participant

    Hello Supun Silva,

    I would like to say that is not a good approach to update the variables that you send to the server.
    Also, it is not correct to create the Grid (or every one widget) more than once, the initialization should be created just one time.
    About that you try to achieve I would like to suggest you look at this tutorial:
    https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-extra-http-variables.htm?search=grid

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

    Refresh grid with $_POST data #96571

    supun151515
    Participant

    Hi Hristo,
    I got it… Thank you very much for your kind support.

    Regards,
    Supun

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

You must be logged in to reply to this topic.