Author Topic: Pro not working for json data  (Read 3733 times)

nathanelliott

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 2
    • View Profile
Pro not working for json data
« on: November 30, 2013, 10:47:44 pm »
I have the same code which is working for standard version and not working for pro version. I can switch back and forth between the two versions. When I use standard, it is fine, pro nothing shows up. I tried adding refresh and clicking the refresh button but still no data. Below is the code I am using.

Any ideas???

<script>
$(function () {
    var colM = [{title: "Count", width: 20, dataType: "integer", align: 'right', dataIndx: "Count" },
                {title: "Year", width: 100, dataType: "string", dataIndx: "year" },
                {title: "State", width: 100, dataType: "string", dataIndx: "state" },
                {title: "City", width: 100, dataType: "string", dataIndx: "citycode" },
                {title: "Make", width: 100, dataType: "string", dataIndx: "make" },
                {title: "Model", width: 200, dataType: "string", dataIndx: "make_model" },
                {title: "CR", width: 50, dataType: "float", align: 'right', dataIndx: "cr_score" },
                {title: "AVG CR", width: 50, dataType: "float", align: 'right', dataIndx: "avgcrscore" },
                {title: "CR Spread", width: 50, dataType: "float", align: 'right', dataIndx: "cr_spread" },
                {title: "Odometer", width: 60, dataType: "integer", align: 'right', dataIndx: "odometer" },
                {title: "Adjusted Odometer", width: 60, dataType: "float", align: 'right', dataIndx: "adjusted_odometer" },
                {title: "AVG Price", width: 70, dataType: "float", align: 'right', dataIndx: "avgprice" },
                {title: "Adjusted Price", width: 70, dataType: "float", align: 'right', dataIndx: "adjusted_price" },
                {title: "Date Added", width: 80, dataType: "string", align: 'right', dataIndx: "dateadded" }];

    var dataModel = {
        location: "remote",
        sorting: "remote",
        paging: "remote",
        dataType: "JSON",
        method: "GET",
        curPage: 1,
        rPP: 20,
        sortIndx: 'Count',
        sortDir: "down",
        rPPOptions: [1, 10, 20, 30, 40, 50, 100, 500, 1000],
        getUrl: function () {
            var sortDir = (this.sortDir == "up") ? "asc" : "desc";
            return { url: "http://sticqrs.com/target_json.php", data: "cur_page=" + this.curPage + "&records_per_page=" +
                this.rPP + "&sortBy=" + this.sortIndx + "&dir=" + sortDir };
        },
        getData: function (dataJSON) {
            return { curPage: dataJSON.curPage, totalRecords: dataJSON.totalRecords, data: dataJSON.data };               
        }
    }
 
    var grid1 = $("div#grid_array").pqGrid({ width: 900, height: 400,
        dataModel: dataModel,
        colModel: colM,
        title:"Target Vehicles",
        resizable: true,
        editable:false,           
        columnBorders: true,
        freezeCols: 2
    });
});
</script>

<div id="grid_array"></div>

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Pro not working for json data
« Reply #1 on: December 01, 2013, 02:12:08 pm »
It's similar to the below post. Please let know whether it helps to fix your issue.

http://paramquery.com/forum/index.php?topic=319.0



nathanelliott

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Pro not working for json data
« Reply #2 on: December 02, 2013, 02:10:28 am »
Thank you much. That post had the answer. Removing this with dataModel fixed all my issues. Onward!