我基本上是使用一个Bottle python
web服务将数据从我的SQL SERVER
数据库发送到JQXGRID
。在
网格的JS代码如下:
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' },
],
});
当我使用GET
请求时,这种方法非常有效。但我真正需要的是能够用POST
方法来实现这一点。
我知道一个事实,数据正顺利到达服务器。问题在于JavaScript无法解释它。
任何线索都会很有帮助。在
我认为pagesize:100不应该在源对象中。它应该是网格设置的一部分。在下面的设置里面。在
请将其从源对象中删除,并检查浏览器控制台中是否有任何错误。在
我建议您查看服务器代码并进行调试。它可能不会向客户端返回任何数据。还要删除formatdata定义,因为除非服务器检查featureClass、style等参数,否则不需要定义
相关问题 更多 >
编程相关推荐