On Wed, Mar 14, 2012 at 5:13 PM, Derrell Lipman
<[email protected]> wrote:
> On Wed, Mar 14, 2012 at 20:01, Scott Chapman <[email protected]> wrote:
>>
>> Hi!
>>
>> I have a Page with a Table on it...
>>
>> qx.Class.define("kiosk_portal.KioskListTab",
>> {
>> extend : qx.ui.tabview.Page,
>> members :
>> {
>> host_id : null
>> },
>> construct : function(label)
>> {
>> this.base(arguments, label);
>> this.setLayout(new qx.ui.layout.Grow());
>>
>> this.__kioskListTable = new kiosk_portal.KioskListTable().set({
>> decorator: null,
>> height: 20,
>> maxWidth: 550
>> });
>>
>> this.add(this.__kioskListTable);
>> this.setShowCloseButton(false);
>> },
>>
>> >From within the kiosk_portal.KioskListTable(), I want to grab the
>> TabView that holds this Page, so I can call a method on it.
>>
>> How to get the parent TabView for this Table?
>
>
> You're using two different names but I think one of them is a typo.
> kiosk_portal.KioskListTable is missing the trailing "le" in the class
> definition, but I think you intend for the question and the class to refer
> to the same thing.
>
> The TabView has two child controls, "bar" and "pane". When you do
> tabView.add(page) you are actually adding the page to the "pane" child.
> Therefore, given a Page object, you should be able to retrieve the TabView
> it's associated with, using:
>
> var tabView = page.getLayoutParent().getLayoutParent();
>
> Let's try it:
>
> http://tinyurl.com/7ro3dzm
>
Thanks Derrell,
I do have two classes, one for the Tab and one for the Table which is
added to the Tab. Here's the Table's class:
qx.Class.define("kiosk_portal.KioskListTable",
{
extend : qx.ui.table.Table,
construct : function()
{
this.base(arguments);
this.setInitiallyHiddenColumns([0,1]);
this.setColumnVisibilityButtonVisible(false);
var tableModel = new qx.ui.table.model.Simple();
tableModel.setColumns([ "ID", "ShortHostString", "MinutesOld", "Host" ]);
this.setTableModel(tableModel);
this.setColumnWidth(0, 70);
this.setColumnWidth(1, 120);
this.setColumnWidth(2, 75);
this.setColumnWidth(3, 420);
this.setStatusBarVisible(true);
this.__jsonHostsListFetcher = new qx.data.store.Json(null);
this.setShowCellFocusIndicator(false);
this.__jsonHostsListFetcher.setUrl("/kiosk_list");
this.__jsonHostsListFetcher.addListener( "loaded",
function(e)
{
this.resetAdditionalStatusBarText();
var tData = e.getData();
var nativeData = [ ];
tData.toArray().forEach(
function(row)
{
nativeData.push(row.toArray());
});
var tableModel = this.getTableModel();
tableModel.setData(nativeData);
var row_count = tableModel.getRowCount();
this.setHeight(40 + 20 * row_count);
},
this);
this.addListener("cellDblclick",
function (e) {
var tableModel = this.getTableModel()
var row = tableModel.getRowData(e.getRow())
var label = row[1];
var host_id = row[0];
this.__tabView.openOrSelectTab(label, host_id);
}
,this);
this.__timer1 = new qx.event.Timer(60000); // 60,000
microseconds = 1 minute
this.__timer1.addListener("interval", function(e)
{
this.setAdditionalStatusBarText(" -- Loading --");
this.__jsonHostsListFetcher.reload();
}, this);
this.__timer1.start();
},
destruct : function()
{
//console.log("destructor called on KioskCompletedTasksTable");
this.__timer1.stop();
//this._disposeObjects("__timer1");
}
});
You can see in the cellDblClick listener that I want to do:
this.__tabView.openOrSelectTab(label, host_id);
So from within this listener, I need the containing TabView that
contains the Tab that contains the Table, so I can tell the TabView to
open a new Tab. I don't know how to get the TabView from within the
Table class.
Scott
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel