Hi Dagur,
here is a example, how you could handle this. Just make some custom events and
fire them on right line :)
qx.Class.define("asa.ui.table.model.AbstractRDM",
{
extend : qx.ui.table.model.Remote,
events :
{
"dataCompleted" : "qx.event.type.Data",
"countCompleted" : "qx.event.type.Data",
"beginLoading" : "qx.event.type.Event",
"stopLoading" : "qx.event.type.Event"
},
properties :
{
searchString :
{
init: null,
nullable : true
},
filterString :
{
init: null,
nullable : true
},
countFunction :
{
init: null,
nullable : true
},
dataFunction :
{
init: null,
nullable : true
}
},
construct : function(countFunction, dataFunction, rpcOptinal)
{
this.base(arguments);
if (countFunction == null)
{
throw "Count function name is missing!";
}
if (dataFunction == null)
{
throw "Data function name is missing!";
}
this.setCountFunction(countFunction);
this.setDataFunction(dataFunction);
// Get an RPC object on which we'll do all of our communication
if (rpcOptinal == null)
{
this.appRoot = qx.core.Init.getApplication();
this.rpc = this.appRoot.rpc;
}
else
{
this.rpc = rpcOptinal;
}
},
members :
{
rpc : null,
reqData : null,
reqCount : null,
/**
* TODOC
*
* @param firstRow {var} TODOC
* @param lastRow {var} TODOC
* @return {void}
*/
_loadRowCount : function(firstRow, lastRow)
{
// Create the handler for our remote procedure call
var clazz = this;
var handler = function(result, ex, id)
{
if (ex !== null)
{
clazz.fireEvent('stopLoading');
}
else
{
clazz.fireEvent('stopLoading');
clazz._onRowCountLoaded(result);
clazz.fireDataEvent('countCompleted',
result);
}
};
var sortIndex = clazz.getColumnId(clazz.getSortColumnIndex());
var sortOrder = clazz.isSortAscending() ? "asc" : "desc";
if (clazz.reqCount != null) {
clazz.rpc.abort(clazz.reqCount);
}
clazz.fireEvent('beginLoading');
clazz.reqCount = clazz.rpc.callAsync(handler, clazz.getCountFunction(),
firstRow, lastRow, sortIndex, sortOrder, clazz.getSearchString(),
clazz.getFilterString());
},
/**
* TODOC
*
* @param firstRow {var} TODOC
* @param lastRow {var} TODOC
* @return {void}
*/
_loadRowData : function(firstRow, lastRow)
{
// Create the handler for our remote procedure call
var clazz = this;
var handler = function(result, ex, id)
{
if (ex !== null)
{
clazz.fireEvent('stopLoading');
}
else
{
clazz.fireEvent('stopLoading');
if (result == null)
{
throw "Result is null, must be
an array!";
}
clazz._onRowDataLoaded(result);
clazz.fireDataEvent('dataCompleted', result);
}
};
// Issue the call to get the row count
// get the column index to sort and the order
var sortIndex = clazz.getColumnId(clazz.getSortColumnIndex());
var sortOrder = clazz.isSortAscending() ? "ASC" : "DESC";
if (clazz.reqData != null) {
clazz.rpc.abort(clazz.reqData);
}
clazz.fireEvent('beginLoading');
clazz.reqData = clazz.rpc.callAsync(handler, clazz.getDataFunction(),
firstRow, lastRow, sortIndex, sortOrder, clazz.getSearchString(),
clazz.getFilterString());
}
}
});
-----Ursprüngliche Nachricht-----
Von: Dagur [mailto:[email protected]]
Gesendet: Montag, 16. April 2012 12:51
An: [email protected]
Betreff: [qooxdoo-devel] RemoteDataModel loading indicator
Hi,
I've implemented a Table that gets its data from a remoteDataModel. I was
wondering if I can somehow make it clear to the user that data is being fetched.
If he scrolls down far enough he'll be looking at empty rows for a few seconds
before the rows are populated and there's no indication that something is
happening. I'm using callAsync to get the data.
regards,
Dagur
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel