回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>我基本上是使用一个<code>Bottle python</code>web服务将数据从我的<code>SQL SERVER</code>数据库发送到<code>JQXGRID</code>。在</p>
<p>网格的JS代码如下:</p>
<pre><code>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' },
],
});
</code></pre>
<p>当我使用<code>GET</code>请求时,这种方法非常有效。但我真正需要的是能够用<code>POST</code>方法来实现这一点。
我知道一个事实,数据正顺利到达服务器。问题在于JavaScript无法解释它。
任何线索都会很有帮助。在</p>