HoSpiTaL_gHoSt

Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • in reply to: JSON Data not Loading #92672
    HoSpiTaL_gHoSt
    Participant

    According to your grid definition, the outcome from your URL should be the following in order to be loaded correctly into your jqGrid:

    {"page":"2″,"records":"50″,"rows":[{"id":"1","total":"cell1","note":"cell2"}],"total":"10″}

    in reply to: Load grid with addJSONData problem #92648
    HoSpiTaL_gHoSt
    Participant

    Yes, I'm sorry for the confusion, the array I showed you also used a jsonReader. If you don't want/need to use a jsonReader, your array should look like this:

    {
    "rows":[{'company':'1','TG_NAME':'1','activeGroup':'1'},{'company':'2','TG_NAME':'2','activeGroup':'2'}],
    "records":2,
    "total":1,
    "page":1
    }

    in reply to: Load grid with addJSONData problem #92541
    HoSpiTaL_gHoSt
    Participant

    This is what your array should look like:

    {
    "data":[{'company':'1','TG_NAME':'1','activeGroup':'1'},{'company':'2','TG_NAME':'2','activeGroup':'2'}],
    "totalRows":2,
    "totalPages":1,
    "page":1
    }

    And you should call addJSONData like this:

    jQuery('#terminalGroups')[0].addJSONData( result );

    in reply to: Load grid with addJSONData problem #92527
    HoSpiTaL_gHoSt
    Participant

    Hi. Read the jqGrid documentation, everything is explained there! addJSONData is a special method:

    Populates a grid with the passed data (an array).This method should be used this way - Example: Suppose we have data from a particular webservice (jsonresponse), then
    var mygrid = jQuery(”#”+grid_id)[0];
    var myjsongrid = eval(”(”+jsonresponse.responseText+”)”);
    mygrid.addJSONData(myjsongrid);
    myjsongrid = null;
    jsonresponse =null;
    will populate the data to the grid. And, of course, the data in myjsongrid can be manipulated before being passed to addJSONData.

    See http://www.trirand.com/jqgridwiki/doku.php?id=wiki:methods

Viewing 4 replies - 1 through 4 (of 4 total)

Stay connected with us in your favorite flavor!