Full vue script :
var pqVS =
{
rpp: 500,
init: function()
{
this.totalRecords = 0
this.requestPage = 1
this.data = []
}
}
pqVS.init();
Vue.component( "pq-grid",
{
props: ["options"],
mounted: function()
{
pq.grid(this.$el, this.options);
},
template: '<div :options="options"></div>'
});
var app = new Vue(
{
el: "#app",
columns1:
[
{ title: "Order ID", width: 100, dataIndx: "ord_id" },
{ title: "Product Id", width: 190, dataIndx: "item_id" },
{ title: "Product Name", width: 250, dataIndx: "prekes_pvd" },
{ title: "Quantity", width: 100, dataIndx: "ord_qnt", align:"right" },
{ title: "Order Date", width: 100, dataIndx: "ord_date"},
{ title: "Order Week", width: 100, dataIndx: "ord_week"},
{ title: "Return Date", width: 100, dataIndx: "ret_date" },
{ title: "Return Week", width: 100, dataIndx: "ret_week" },
{ title: "Fact Date", width: 100, dataIndx: "fact_date" },
{ title: "Fact Week", width: 100, dataIndx: "fact_week" },
],
data1:
{
dataType: "JSON",
location: "remote",
url: "phpf/remote.php",
postData: function()
{
return
{
pq_curpage = pqVS.requestPage,
pq_rpp = pqVS.rpp
};
},
getData: function( response )
{
debugger
var data = response.data,
totalRecords = response.totalRecords,
len = data.length,
curPage = response.curPage,
pq_data = pqVS.data,
init = ( curPage - 1 ) * pqVS.rpp;
if ( !pqVS.totalRecords )
{
for ( var i = len; i < totalRecords; i++ )
{
pq_data[ i + init ] = { pq_empty: true }
}
pqVS.totalRecords = totalRecords
}
for ( var i = 0; i < len; i++ )
{
pq_data[ i + init ] = data[ i ]
pq_data[ i + init ].pq_empty = false
}
return { data: pq_data }
},
error: function ( jqXHR, textStatus, errorThrown)
{
//alert(errorThrown);
}
},
data: function()
{
this.options =
{
showTitle: false,
reactive: true,
locale: "lt",
height: "flex",
numberCell: { show: false },
columnTemplate: { width: 100 },
colModel: this.$options.columns1,
animModel: { on: true },
dataModel: this.data1 //{ data: this.$options.data1 }
};
return {};
}
});