Author Topic: local JSON help  (Read 2596 times)

roundy72

  • Newbie
  • *
  • Posts: 2
    • View Profile
local JSON help
« on: August 29, 2014, 01:27:24 am »
hello all!  can someone tell me what i'm doing wrong here?  this keeps giving me an error "Object doesn't support property or method 'slice'".
I'm using the simplest JSON possible (from MSDN site):


var colM = [
                        { title: "Phone", width: 100, dataType: "string", editable: false }
                    ];

                    var jsontext = '{"data":["555-0100","555-0120"]}';
                    var contact = JSON.parse(jsontext);
                   
                    var dataM = {
                        data: contact,
                        location: "local",
                        sorting: "local",
                        paging: "local"
                    }

                    var grid1 = $("div#grid_local_sorting").pqGrid({
                        width: 976,
                        height: 300,
                        collapsible: false,
                        pageModel: { type: "local", rPP: 20, strRpp: "{0}", strDisplay: "{0} to {1} of {2}" },
                        selectionModel: { swipe: true },
                        dataModel: dataM,
                        colModel: colM,
                        wrap: false, hwrap: false,         
                        numberCell: { show: false, resizable: true, title: "#" },
                        title: "Search Results",
                        resizable: true
                    });




my ultimate goal is to use the dataIndx property so I can specify which data appears where in the columns, like this:

var jsontext = '{"data":[{ "phone1" : "555-0100", "phone2" : "555-0120" }]}';
...
var colM = [
    { title: "Primary Phone", width: 100, dataType: "string", editable: false, dataIndx: "phone1" }
];

... expecting 555-0100 to show...




« Last Edit: August 29, 2014, 01:29:55 am by roundy72 »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: local JSON help
« Reply #1 on: September 02, 2014, 06:40:11 pm »
Is it possible for you to create a jsfiddle http://jsfiddle.net/LAgZx/64/