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.