PDA

View Full Version : ScriptTagProxy displays no data



kurt schrauwen
18 Jun 2010, 3:22 AM
Hai everyone,

I'm have a problem with the ScriptTagProxy and I don't find the problem.
I see the returned values in firedebug but no data displayed.

I'm missing or ove rlooking somthing but what ?!
Can someone help me ?

My .js file looks like :



var ds_mainDataStore; // this will be our datastore
var datastoreColumnModel; // this will be our columnmodel

Ext.onReady(function(){

var ds_mainDataStore = new Ext.data.Store({
autoLoad: true,
proxy: new Ext.data.ScriptTagProxy({
url: 'http://localhost/filterColumns/filterColumnsSQL.php'
}),
reader: new Ext.data.JsonReader({root:'rows',totalProperty: 'results',id:'attributeID'}, [
'attributeID',
'tableCode',
'rowCode',
'numericValue',
'charValue',
'datetimeValue',
'description',
'active',
'insID',
'insDate',
'insLoc',
'updID',
'updDate',
'updLoc'
])
});
//ds_mainDataStore.load();


datastoreColumnModel = new Ext.grid.ColumnModel(
[
{header: "<b>attributeID</b>", dataIndex: 'attributeID', width: 75},
{header: "<b>tableCode</b>", dataIndex: 'tableCode', width: 150},
{header: "<b>rowCode</b>", dataIndex: 'rowCode', width: 75},
{header: "<b>numericValue</b>", dataIndex: 'numericValue', width: 150},
{header: "<b>charValue</b>", dataIndex: 'charValue', width: 150},
{header: "<b>datetimeValue</b>",dataIndex: 'datetimeValue', width: 150},
{header: "<b>description</b>", dataIndex: 'description', width: 150},
{header: "<b>active</b>", dataIndex: 'active', width: 150},
{header: "insID", dataIndex: 'insID', width: 150, hidden:true},
{header: "insDate", dataIndex: 'insDate', width: 150, hidden:true},
{header: "insLoc", dataIndex: 'insLoc', width: 150, hidden:true},
{header: "updID", dataIndex: 'updID', width: 150, hidden:true},
{header: "updDate", dataIndex: 'updDate', width: 150, hidden:true},
{header: "updLoc", dataIndex: 'updLoc', width: 150, hidden:true}
]
);
datastoreColumnModel.defaultSortable= true;


var attributeListEditorGrid = new Ext.grid.EditorGridPanel({
region: 'center',
id: 'attributeListEditorGrid',
frame:true,
header: true,
iconCls: 'icon-grid',
title: 'Attributes',
store: ds_mainDataStore,
cm: datastoreColumnModel,
enableColumnMove: true,
stripeRows: true,
trackMouseOver: true,
columnLines: true,

selModel: new Ext.grid.RowSelectionModel({singleSelect:true})
});


// viewport
new Ext.Viewport({
layout: 'border',
items: [attributeListEditorGrid]
});


});



This is my PHP file to get the data from the db :



require_once('mySQL_DB_connection.php');
ini_set("display_errors", true);
ini_set("html_errors", true);
// Get connection
Connection::NewConnection("localhost", "sdsherfurthgroup", "intuser", "zfruser");
$callback = $_REQUEST['callback'];
$sql = "SELECT * FROM flt_attributes";
$encodable = array();
$result = mysql_query($sql);
$totalCount = mysql_num_rows($result);
//$sql = "SELECT * FROM flt_attributes LIMIT 5";
$result = mysql_query($sql);
while($obj = mysql_fetch_object($result))
{
$encodable[] = $obj;
}

mysql_close();
$encoded = '';
if($callback) $encoded = $callback . "(";
$encoded .= '({"total" : "' . $totalCount . '", "results" : ' . json_encode($encodable) . '})';
if($callback) $encoded .= ");";
echo $encoded;


And this is the result I see in fire bug :
stcCallback1001(({
"total" : "9",
"results" : [{"attributeID":"1","tableCode":"ConditionOperator","rowCode":"1","numericValue":null,"charValue":"AND","datetimeValue":null,"description":"AND","active":"Y","insID":null,"insDate":null,"insLoc":null,"updID":null,"updDate":null,"updLoc":null},
{"attributeID":"2","tableCode":"ConditionOperator","rowCode":"2","numericValue":null,"charValue":"OR","datetimeValue":null,"description":"OR","active":"Y","insID":null,"insDate":null,"insLoc":null,"updID":null,"updDate":null,"updLoc":null},
{"attributeID":"3","tableCode":"Operator","rowCode":"1","numericValue":null,"charValue":"LIKE","datetimeValue":null,"description":"Like (Search for a pattern, use wildcards)","active":"N","insID":null,"insDate":null,"insLoc":null,"updID":null,"updDate":null,"updLoc":null},
{"attributeID":"4","tableCode":"Operator","rowCode":"2","numericValue":null,"charValue":"=","datetimeValue":null,"description":"Equal to","active":"N","insID":null,"insDate":null,"insLoc":null,"updID":null,"updDate":null,"updLoc":null},
{"attributeID":"5","tableCode":"Operator","rowCode":"3","numericValue":null,"charValue":"<>","datetimeValue":null,"description":"is Not Equal to","active":"N","insID":null,"insDate":null,"insLoc":null,"updID":null,"updDate":null,"updLoc":null},
{"attributeID":"6","tableCode":"Operator","rowCode":"4","numericValue":null,"charValue":"<","datetimeValue":null,"description":"Less than","active":"N","insID":null,"insDate":null,"insLoc":null,"updID":null,"updDate":null,"updLoc":null},
{"attributeID":"7","tableCode":"Operator","rowCode":"5","numericValue":null,"charValue":">","datetimeValue":null,"description":"Greater than","active":"N","insID":null,"insDate":null,"insLoc":null,"updID":null,"updDate":null,"updLoc":null},
{"attributeID":"8","tableCode":"Operator","rowCode":"6","numericValue":null,"charValue":">=","datetimeValue":null,"description":"Greater than or Equal to","active":"N","insID":null,"insDate":null,"insLoc":null,"updID":null,"updDate":null,"updLoc":null},
{"attributeID":"9","tableCode":"Operator","rowCode":"7","numericValue":null,"charValue":"<=","datetimeValue":null,"description":"Less than or Equal to","active":"N","insID":null,"insDate":null,"insLoc":null,"updID":null,"updDate":null,"updLoc":null}]}));

Animal
18 Jun 2010, 3:26 AM
Check the config of your reader carefully.

And post with [code] tags!

kurt schrauwen
18 Jun 2010, 3:40 AM
Hai Animal,

With reader do you mean my "Ext.data.JsonReader" or do you mean mij PHPfile to get the data from the DB ?

Animal
18 Jun 2010, 3:50 AM
You have


reader: new Ext.data.JsonReader({root:'rows',totalProperty: 'results',id:'attributeID'},


And your JSON is



{
"total": "9",
"results": [
{
"attributeID": "1",
"tableCode": "ConditionOperator",
"rowCode": "1",
"numericValue": null,
"charValue": "AND",
"datetimeValue": null,
"description": "AND",
"active": "Y",
"insID": null,
"insDate": null,
"insLoc": null,
"updID": null,
"updDate": null,
"updLoc": null
}...


http://www.sencha.com/deploy/dev/docs/?class=Ext.data.JsonReader

kurt schrauwen
18 Jun 2010, 4:07 AM
Hai Animal,
Thanks for the help, I've got it working !
I think I already have the friday blues

Greetz,
Kurt