Error in DWR proxy
March 11th, 2010I am using DWRProxy to load data in a grid. When the page loads i got an error in my firebug as
"Ext.data.DWRProxy is not a constructor.
proxy: new Ext.data.DWRProxy(search.check, true),"Also, i can see that response is coming as required in firebug but still no grid population happens because of the error.
My grid code is:
var GridUI = function() {
var ds;
var grid; //component
var columnModel; // definition of the columns
function initDataSource() {
var recordType = Ext.data.Record.create([
{name: "source", width: 120,type: "String"},
{name: "destination", width: 120, type: "string"},
{name: "airlinename", mapping:"flight.airlineName", width: 120, type: "string"},
{name: "flightno", mapping:"flight.flightNo", width: 120, type: "string"}
]);
ds = new Ext.data.Store({
proxy: new Ext.data.DWRProxy(search.check, true),
reader: new Ext.data.ListRangeReader(
{id:'id', totalProperty:'totalSize'}, recordType),
remoteSort: true
});
ds.on("load", function () {
});
}
function getColumnModel() {
if(!columnModel) {
columnModel = new Ext.grid.ColumnModel(
[
{
header: 'Source',
width: 250,
sortable: true,
dataIndex: 'source'
})
},
{
header: 'Destination',
width: 250,
sortable: true,
dataIndex: 'destination'
},
{
header: 'Airline Name',
width: 250,
sortable: true,
dataIndex: 'airlinename'
}
,
{
header: 'Flight Number',
width: 250,
sortable: true,
dataIndex: 'flightno'
}
]
);
}
return columnModel;
}
function buildGrid() {
grid = new Ext.grid.GridPanel({
ds: ds,
viewConfig: {forceFit: true},
cm: getColumnModel(),
stripeRows: true,
sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
height:350,
width:600,
collapsible: true,
title:'Grid'
});
grid.render('result');
}
return {
init : function() {
initDataSource();
ds.load({params:{start:0, limit:22}, arg:['ABC', true]});
buildGrid();
},
getStore: function() {
return ds;
}
}
}();
Ext.onReady(GridUI.init, GridUI, true);
on HTML page:
proxy: new Ext.ux.data.DWRProxy({
dwrFunction: search.check,
listeners: {
listeners: {
"beforeload" : function(dataProxy, params) {
params[dataProxy.loadArgsKey] = [your_string1, your_string2];
}
More info in this thread: http://extjs.com/forum/showthread.php?t=23884
Now somone please tell me how can i pass params at runtime in DWR class.
#If you have any other info about this subject , Please add it free.# |