jQuery UI Widgets Forums Grid Assign json data coming from server to grid

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

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

  • mallepaddi
    Participant

    Hi

    For some purpose I’m making ajax call as below..

    var localData = new Array();
    $.ajax({
    type : “POST”,
    url : ‘/dataServlet?action=Details’,
    data : ‘orderNo=12345’,
    success : function(data) {
    var obj = eval (“(” + data + “)”);
    alert(data);
    localData = obj.productList;
    },
    error:function(){
    alert(‘Oops!!! error …’);
    }
    });

    which return “data” as follows .. and i need to assign “”productList” to the grid …
    {
    “poNumber”: “X”,
    “poDate”: “0000-00-00”,
    “deliverydate”: “2013-04-24”,
    “shipTo”: “SIAM PARAGON RETAIL CO.,LTD.”,
    “remarks”: “Yet to add remarks in FM”,
    “productList”: [
    {
    “isSelected”: false,
    “productCode”: “000000000100009001”,
    “productDesc”: “ISMO TAB 20MG 10X10”,
    “productSupplier”: “”,
    “productPrice”: “300.00”,
    “productQty”: “0.000”,
    “productCurrency”: “THB”,
    “productUom”: “BOX”
    },
    {
    “isSelected”: false,
    “productCode”: “000000000100074819”,
    “productDesc”: “Paracetamol”,
    “productSupplier”: “”,
    “productPrice”: “0.00”,
    “productQty”: “0.000”,
    “productCurrency”: “THB”,
    “productUom”: “PC”
    }
    ]
    }

    var productSource = {
    datafields: productListFields,
    localdata: localData,
    id: ‘productCode’
    };

    nut grid shows empty rows ..

    please help.

    Thanks


    Dimitar
    Participant

    Hello mallepaddi,

    You should map your source datafields correctly for the grid to be populated successfully. Please refer to Example #3 (nested JSON data) for the map datafield option in the jqxGrid Data Sources documentation entry for more information.

    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.