1

I am basically trying to send data from my SQL SERVER database to JQXGRID using a Bottle python web service.

The JS code for the grid is below:

var source =
       {
            datatype: "json",
            pagesize: 100,
            type: "POST",
            datafields:
            [
                { name: 'Rank', type: 'number' },
                { name: 'Title', type: 'string' },
                { name: 'Studio', type: 'string' },
                { name: 'Volume', type: 'Number' },
                { name: 'Price', type: 'number' },
                { name: 'Average', type: 'number' },
                { name: 'Category', type: 'string' },
                { name: 'Release Week', type: 'string' },

            ],
            url: "http://localhost:8080/titles"
       };


        var dataAdapter = new $.jqx.dataAdapter(source, 
            {
                formatData: function (data) {
                    $.extend(data, {
                        featureClass: "P",
                        style: "full",
                        maxRows: 50,
                             });
                    return data;
                }
            }
        );
        $("#topsharedtitles").jqxGrid(
        {
            source: dataAdapter,
            width: 960,
            rowdetails: false,
            selectionmode: 'multiplerowsextended',
            sortable: true,
            pageable: true,
            autoheight: true,
            autoloadstate: false,
            autosavestate: false,
            columnsresize: true,
            columnsreorder: true,
            showfilterrow: true,
            filterable: true,
            columnsheight: 50,
            columns: [
              { text: 'RK', datafield: 'Rank', width: 50, align: 'center', cellsalign: 'center' },
              { text: 'TITLE', datafield: 'Title', width: 300, align: 'center', cellsalign: 'left' },
              { text: 'RELEASE<br>WEEK', datafield: 'Release Week' , width: 90, align: 'center',cellsalign: 'center' },
              { text: 'STUDIO', datafield: 'Studio', width: 200, align: 'center', cellsalign: 'left' },
              { text: 'CATEGORY', datafield: 'Category', width: 80, align: 'center', cellsalign: 'center' },
              { text: 'UNITS<br>100%', datafield: 'Volume',  width: 80, align: 'center', cellsalign: 'center'  },
              { text: 'EURO<br>100%', datafield: 'Price',  width: 80, align: 'center', cellsalign: 'center'  },
              { text: 'AV PRICE', datafield: 'Average',  width: 80, align: 'center' , cellsalign: 'center' },

                                           ],
        });

This works perfectly when I use the GET request. But what I really need is to be able to do this with the POST method. I know for a fact that the data is reaching the server fine. The problem lies with the JavaScript not being able to interpret it. Any leads would be really helpful.

Tauseef Hussain
  • 1,049
  • 4
  • 15
  • 29

2 Answers2

1

I think the pagesize: 100 should not be in the source object. It is suppose to be a part of the grid settings. Inside of the below settings.

$("#jqxgrid").jqxGrid();

Please remove this from the source object and please check whether you are getting any errors in the browser console.

NathanOliver
  • 171,901
  • 28
  • 288
  • 402
Sibeesh Venu
  • 18,755
  • 12
  • 103
  • 140
0

I suggest you to look at your server code and debug it. It probably does not return to the client side any data. Also remove your formatdata definition because it's not necessary unless your server checks for parameters like featureClass, style, etc.

scripto
  • 2,297
  • 1
  • 14
  • 13