bas_denis
17 Apr 2009, 4:06 AM
any working DirectStore example?
me don't get it,
help appreciated (if using svn version plz mention)
backend and Provider is not needed / not in detail, those are working fine
(used Ext.Direct Example and added a getData method which gives some Array of Objects Result)
kind regards
my try:
post:
{"action":"TestAction","method":"getData","data":null,"type":"rpc","tid":2}
response:
{"type":"rpc","tid":2,"action":"TestAction","method":"getData",
"result":[
{"id":1,"value":"Value 1"},
{"id":2,"value":"Value 1"},
{"id":3,"value":"Value 2"}
]}
testcase:
Ext.onReady(function()
{
Ext.Direct.addProvider({
url : "php/router.php",
type : "remoting",
id : 'remote-provider',
actions : {
TestAction : [
{
name : "getData",
len : 0
}
]
}
});
var getData = new Ext.Button({
text : 'getData',
handler : function()
{
TestAction.getData(function(result, e)
{
console.debug(result)
});
}
});
var store = new Ext.data.DirectStore({
autoLoad : true,
// directFn isn't recognized by proxy, used api:load instead
api : {
load : TestAction.getData
},
root : 'result',
paramsAsHash : false,
fields : [
'id',
'value'
],
listeners : {
load : function()
{
console.info('load', this, arguments)
},
loadexception : function()
{
console.warn('loadexception', this, arguments)
},
scope : this
}
});
var grid = new Ext.grid.GridPanel({
store : store,
columns : [
{
id : 'id',
header : 'id',
width : 200,
dataIndex : 'id'
},
{
header : 'value',
width : 120,
dataIndex : 'value'
}
],
viewConfig : {
forceFit : true
},
sm : new Ext.grid.RowSelectionModel({
singleSelect : true
})
});
var p = new Ext.Panel({
title : 'Remote Call Grid',
width : 600,
height : 300,
layout : 'fit',
items : [
grid
],
bbar : [
getData
]
}).render(Ext.getBody());
});
added bugnote: [3.0 RC1] Ext.data.DirectProxy incomplete ? (http://extjs.com/forum/showthread.php?t=65919)
me don't get it,
help appreciated (if using svn version plz mention)
backend and Provider is not needed / not in detail, those are working fine
(used Ext.Direct Example and added a getData method which gives some Array of Objects Result)
kind regards
my try:
post:
{"action":"TestAction","method":"getData","data":null,"type":"rpc","tid":2}
response:
{"type":"rpc","tid":2,"action":"TestAction","method":"getData",
"result":[
{"id":1,"value":"Value 1"},
{"id":2,"value":"Value 1"},
{"id":3,"value":"Value 2"}
]}
testcase:
Ext.onReady(function()
{
Ext.Direct.addProvider({
url : "php/router.php",
type : "remoting",
id : 'remote-provider',
actions : {
TestAction : [
{
name : "getData",
len : 0
}
]
}
});
var getData = new Ext.Button({
text : 'getData',
handler : function()
{
TestAction.getData(function(result, e)
{
console.debug(result)
});
}
});
var store = new Ext.data.DirectStore({
autoLoad : true,
// directFn isn't recognized by proxy, used api:load instead
api : {
load : TestAction.getData
},
root : 'result',
paramsAsHash : false,
fields : [
'id',
'value'
],
listeners : {
load : function()
{
console.info('load', this, arguments)
},
loadexception : function()
{
console.warn('loadexception', this, arguments)
},
scope : this
}
});
var grid = new Ext.grid.GridPanel({
store : store,
columns : [
{
id : 'id',
header : 'id',
width : 200,
dataIndex : 'id'
},
{
header : 'value',
width : 120,
dataIndex : 'value'
}
],
viewConfig : {
forceFit : true
},
sm : new Ext.grid.RowSelectionModel({
singleSelect : true
})
});
var p = new Ext.Panel({
title : 'Remote Call Grid',
width : 600,
height : 300,
layout : 'fit',
items : [
grid
],
bbar : [
getData
]
}).render(Ext.getBody());
});
added bugnote: [3.0 RC1] Ext.data.DirectProxy incomplete ? (http://extjs.com/forum/showthread.php?t=65919)