On Mon, Mar 12, 2012 at 10:14, totty <[email protected]> wrote:
> It's ok If I extend this way the qx.ui.table.Table Class? or I might get
> some
> issues?
>
I see a couple of possible issues:
Most importantly, you are adding a new listener each time the model
changes, without ever removing old listeners. You probably want to save the
listener id returned by addListener(), and remove it before adding a new
one.
Secondly, and much less importantly, you don't need a 'that' closure for
the listener. The third parameter to addListener() is the context variable,
so you can just pass 'this' as the third parameter to both of your
addListener() calls to get the same result without the closure.
Cheers,
Derrell
>
> qx.Class.define('test1.TTable', {
> extend: qx.ui.table.Table,
>
> construct: function(model){
> // listen for when a model is added
> var that = this;
> this.addListener('changeTableModel', function(e){
> var model = that.getSelectionModel();
> if(model){
> model.addListener('changeSelection',
> function(e){
> var selectionModel = e.getTarget();
> var selectedRows = [];
> var tableModel =
> that.getTableModel();
>
> selectionModel.iterateSelection(function(index) {
>
> selectedRows.push(tableModel.getRowDataAsMap(index));
> });
> var data = selectedRows;
>
> // dispatch the event
> that.setCurrentSelection(data);
> })
> }
> });
> this.base(arguments, model);
> },
>
> properties: {
> currentSelection: {
> nullable: true,
> event: "changeCurrentSelection"
> }
> }
>
> });
>
> thanks (:
>
> --
> View this message in context:
> http://qooxdoo.678.n2.nabble.com/It-s-ok-If-I-extend-this-way-the-qx-ui-table-Table-Class-or-I-might-get-some-issues-tp7365399p7365399.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel