randomY
11 Sep 2009, 9:54 AM
I've already read more that one thread on this same subject. Either they haven't helped or the person was just left unanswered.
I've been trying to populate a simple test grid using the Ext direct-pack download. Am running under ext ver 3.0.1, but same result under svn. My store looks like:
var reader = new Ext.data.JsonReader({
successProperty: 'success',
idProperty: 'id',
root: 'result',
fields: [
{name: 'id', type: 'int'},
{name: 'tag', type: 'string'},
{name: 'val', type: 'string'}
],
});
var store = new Ext.data.DirectStore({
reader: reader,
storeId: 'areastore-id',
autoLoad: true,
remoteSort: false,
api: {
read: IRIS.AreaSubstitutions.read,
create: IRIS.AreaSubstitutions.create,
destroy: IRIS.AreaSubstitutions.destroy,
update: IRIS.AreaSubstitutions.updat
},
});
Nothing special about that.
On the server I have classes/AreaSubstitutions.php:
class AreaSubstitutions {
/**
* @remotable
* @remoteName read
*/
public function read() {
$dbf = getenv('VI_DB');
$db = new SQLite3($dbf.'/Area_DEFAULT.sqlite');
$res = $db->query("SELECT * FROM area_substitutions");
while ($row = $res->fetchArray()) {
$arr[] = $row;
}
return $arr;
}
etc...
I assume my problem is how am not doing anything special other that just returning the array, but there are no examples to look at.
The post to the server looks like:
{
"action":"AreaSubstitutions",
"method":"read",
"data":null,
"type":"rpc",
"tid":2
}The return from the server:
{
"type":"rpc",
"tid":2,
"action":"AreaSubstitutions",
"method":"read",
"result":[
{"0":1,"id":1,"1":"GeneralHiPassFilter","tag":"GeneralHiPassFilter","2":"2,4","val":"2,4"},
{"0":2,"id":2,"1":"ChansPerStreamer","tag":"ChansPerStreamer","2":"324","val":"324"},
{"0":101,"id":101,"1":"MinDispRawData","tag":"MinDispRawData","2":"-2","val":"-2"},
{"0":102,"id":102,"1":"MaxDispRawData","tag":"MaxDispRawData","2":"2","val":"2"},
{"0":103,"id":103,"1":"MinDispRMSData","tag":"MinDispRMSData","2":"1","val":"1"},
{"0":104,"id":104,"1":"MaxDispRMSData","tag":"MaxDispRMSData","2":"40","val":"40"}
]
}
I realize that there is no 'success' property in this return.
This test is of a copy of a bit of an actual application which uses a normal Ext.data.Store with a JsonReader. That bit of code works fine and the result looks like:
{
success: 'true',
results:
[
{"0":1,"id":1,"1":"GeneralHiPassFilter","tag":"GeneralHiPassFilter","2":"2,4","val":"2,4"},
{"0":2,"id":2,"1":"ChansPerStreamer","tag":"ChansPerStreamer","2":"324","val":"324"},
{"0":101,"id":101,"1":"MinDispRawData","tag":"MinDispRawData","2":"-2","val":"-2"},
{"0":102,"id":102,"1":"MaxDispRawData","tag":"MaxDispRawData","2":"2","val":"2"},
{"0":103,"id":103,"1":"MinDispRMSData","tag":"MinDispRMSData","2":"1","val":"1"},
{"0":104,"id":104,"1":"MaxDispRMSData","tag":"MaxDispRMSData","2":"40","val":"40"}
]
}
Any insight would be appreciated.
I've been trying to populate a simple test grid using the Ext direct-pack download. Am running under ext ver 3.0.1, but same result under svn. My store looks like:
var reader = new Ext.data.JsonReader({
successProperty: 'success',
idProperty: 'id',
root: 'result',
fields: [
{name: 'id', type: 'int'},
{name: 'tag', type: 'string'},
{name: 'val', type: 'string'}
],
});
var store = new Ext.data.DirectStore({
reader: reader,
storeId: 'areastore-id',
autoLoad: true,
remoteSort: false,
api: {
read: IRIS.AreaSubstitutions.read,
create: IRIS.AreaSubstitutions.create,
destroy: IRIS.AreaSubstitutions.destroy,
update: IRIS.AreaSubstitutions.updat
},
});
Nothing special about that.
On the server I have classes/AreaSubstitutions.php:
class AreaSubstitutions {
/**
* @remotable
* @remoteName read
*/
public function read() {
$dbf = getenv('VI_DB');
$db = new SQLite3($dbf.'/Area_DEFAULT.sqlite');
$res = $db->query("SELECT * FROM area_substitutions");
while ($row = $res->fetchArray()) {
$arr[] = $row;
}
return $arr;
}
etc...
I assume my problem is how am not doing anything special other that just returning the array, but there are no examples to look at.
The post to the server looks like:
{
"action":"AreaSubstitutions",
"method":"read",
"data":null,
"type":"rpc",
"tid":2
}The return from the server:
{
"type":"rpc",
"tid":2,
"action":"AreaSubstitutions",
"method":"read",
"result":[
{"0":1,"id":1,"1":"GeneralHiPassFilter","tag":"GeneralHiPassFilter","2":"2,4","val":"2,4"},
{"0":2,"id":2,"1":"ChansPerStreamer","tag":"ChansPerStreamer","2":"324","val":"324"},
{"0":101,"id":101,"1":"MinDispRawData","tag":"MinDispRawData","2":"-2","val":"-2"},
{"0":102,"id":102,"1":"MaxDispRawData","tag":"MaxDispRawData","2":"2","val":"2"},
{"0":103,"id":103,"1":"MinDispRMSData","tag":"MinDispRMSData","2":"1","val":"1"},
{"0":104,"id":104,"1":"MaxDispRMSData","tag":"MaxDispRMSData","2":"40","val":"40"}
]
}
I realize that there is no 'success' property in this return.
This test is of a copy of a bit of an actual application which uses a normal Ext.data.Store with a JsonReader. That bit of code works fine and the result looks like:
{
success: 'true',
results:
[
{"0":1,"id":1,"1":"GeneralHiPassFilter","tag":"GeneralHiPassFilter","2":"2,4","val":"2,4"},
{"0":2,"id":2,"1":"ChansPerStreamer","tag":"ChansPerStreamer","2":"324","val":"324"},
{"0":101,"id":101,"1":"MinDispRawData","tag":"MinDispRawData","2":"-2","val":"-2"},
{"0":102,"id":102,"1":"MaxDispRawData","tag":"MaxDispRawData","2":"2","val":"2"},
{"0":103,"id":103,"1":"MinDispRMSData","tag":"MinDispRMSData","2":"1","val":"1"},
{"0":104,"id":104,"1":"MaxDispRMSData","tag":"MaxDispRMSData","2":"40","val":"40"}
]
}
Any insight would be appreciated.