Hello list,
I try to switch from table Simple to the Remote Table model.
The Simple Model with PHP backend receiving data from a db works fine. But
with the Remote Model I have some problems.
I copied the example code from the 1.2 docu.
RemoteTable.js
--------------------------------------------------------------------------------
qx.Class.define("myApp.RemoteTable",
{
extend : qx.ui.table.model.Remote,
members :
{
// overloaded - called whenever the table requests the row count
_loadRowCount : function()
{
// Call the backend service (example) - using XmlHttp
var baseUrl = "http://localhost/myApp/statusRowCount.php";
var parameters = "?UserID=2";
var url = baseUrl + parameters;
var req = new qx.io.remote.Request(url, "GET", "application/json");
// Add listener
req.addListener("completed", this._onRowCountCompleted, this);
// send request
req.send();
},
// Listener for request of "_loadRowCount" method
_onRowCountCompleted : function(response)
{
var result = response.getContent();
if (result != null)
{
// Apply it to the model - the method "_onRowCountLoaded" has to
be called
this._onRowCountLoaded(result);
}
},
// overloaded - called whenever the table requests new data
//_loadRowData : function(firstRow, lastRow)
_loadRowData : function()
{
// Call the backend service (example) - using XmlHttp
var baseUrl = "http://localhost/myApp/status.php";
//var parameters = "?from=" + firstRow + "&to=" + lastRow;
var parameters = "?UserID=2";
var url = baseUrl + parameters;
var req = new qx.io.remote.Request(url, "GET", "application/json");
// Add listener
req.addListener("completed", this._onLoadRowDataCompleted, this);
// send request
req.send();
},
// Listener for request of "_loadRowData" method
_onLoadRowDataCompleted : function(response)
{
var result = response.getContent();
if (result != null)
{
// Apply it to the model - the method "_onRowDataLoaded" has to be
called
this._onRowDataLoaded(result);
}
}
}
});
---------------------------------------------------------------------------------
Here is my status.js class which creates the table
qx.Class.define("myApp.jobstatus",
{
extend : qx.ui.window.Window,
construct : function(UserID) {
// Call super class
this.base(arguments, this.tr("Status Information"));
var mycellrenderer = new myApp.MyCellRenderer();
// Enable logging in debug variant
if (qx.core.Variant.isSet("qx.debug", "on"))
{
// support native logging capabilities, e.g. Firebug for Firefox
qx.log.appender.Native;
// support additional cross-browser console. Press F7 to toggle
visibility
qx.log.appender.Console;
}
this.setLayout(new qx.ui.layout.VBox(10));
this.setStatus("Application is ready");
var tableModel = new myApp.RemoteTable();
tableModel.setColumns([ this.tr("State"), this.tr("FileName"),
this.tr("FileSize"), this.tr("Date") ]);
var table = new qx.ui.table.Table(tableModel);
table.setTableModel(tableModel);
table.setLayoutProperties({top: 120});
table.setLayoutProperties({left: 200});
table.setWidth(500);
table.setHeight(200);
with (table) {
getSelectionModel().setSelectionMode(qx.ui.table.selection.Model.SINGLE_SELECTION);
setColumnWidth(0, 50);
setColumnWidth(1, 200);
setColumnWidth(2, 80);
setColumnWidth(3, 150);
};
this.add(table);
table.addListener('appear',function(){
tableModel._loadRowData();
//tableModel.setData([]);//reset before
});
var tcm = table.getTableColumnModel();
// Use the custom cell renderer for column 1
tcm.setDataCellRenderer(0, new myApp.MyCellRenderer());
}//main function
//}//menbers
});
The problem is that no data appears in the table. I can see the correct row
count (90) in the Firebug console and also I can see the data received from
"status.php"
The row count 90 is also displayed in the table but no data.
Perhaps the call with
table.addListener('appear',function(){
tableModel._loadRowData();
is not correct?
Thanks in advance for any help
regards
Hans
--
View this message in context:
http://old.nabble.com/Beginner-question-Remote-Table-no-data-in-table--tp30075325p30075325.html
Sent from the qooxdoo-devel mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel