On Wed, Jun 20, 2012 at 3:57 PM, Scott Chapman <[email protected]> wrote:
> Thanks! I'm getting close. Here's the top of my table class with the mixin
> included:
>
Aside from the semantic errors (e.g., derefencing a variable called
'selection' when it has not been defined nor initialized), the big problem
is that you're using the mixin from within the constructor, where the
mixin's constructor hasn't yet been called. A mixin's constructor is called
after the constructor of the class that includes it.
Here's a modified test class that also puts member functions into the
members section where they really ought to go, unless there's some really
good reason for assigning them in the constructor.
Hope this helps,
Derrell
qx.Class.define("testapp.TableKioskCompletedTasks",
{
include : [qx.ui.table.MTableContextMenu],
extend : qx.ui.table.Table,
construct : function()
{
this.base(arguments);
this.setInitiallyHiddenColumns([0]);
this.setColumnVisibilityButtonVisible(false);
var tableModel = new qx.ui.table.model.Simple();
tableModel.setColumns([ "Task ID", "Group", "Task", "Parameter",
"Completed", "Requestor", "Status" ]);
this.setTableModel(tableModel);
this.setColumnWidth(1, 70);
this.setColumnWidth(2, 100);
this.setColumnWidth(3, 120);
this.setColumnWidth(4, 120);
this.setColumnWidth(5, 70);
this.setColumnWidth(6, 90);
this.setStatusBarVisible(true);
this.__jsonCompletedTasksFetcher = new qx.data.store.Json(null);
var tcm = this.getTableColumnModel();
tcm.setDataCellRenderer(2, new qx.ui.table.cellrenderer.Html());
tcm.setDataCellRenderer(6, new qx.ui.table.cellrenderer.Html());
this.setShowCellFocusIndicator(false);
qx.util.TimerManager.getInstance().start(
function()
{
this.setContextMenuHandler(1, this._contextMenuHandler);
},
0,
this);
},
members :
{
__reQueue : function()
{
var selection = this.getSelectionModel().getSelectedRanges();
var row_number = selection[0].minIndex;
var tableModel = this.getTableModel();
var row = tableModel.getRowData(row_number);
var task_id = row[0];
var user_info =
qx.core.Init.getApplication().getUserData("user_info");
var requestor = user_info['username'];
var request_data = {"task_id": task_id, "requestor": requestor};
var req = new qx.io.request.Xhr("/requeue_task/" + task_id, "POST");
req.setRequestData(request_data);
req.send();
},
_contextMenuHandler : function(col, row, table, dataModel, contextMenu)
{
var selection = this.getSelectionModel().getSelectedRanges();
if (selection.length !== 0)
{
var exportCsvButton = new qx.ui.menu.Button("ReQueue");
exportCsvButton.addListener("execute", this.__reQueue);
contextMenu.add(exportCsvButton);
return true;
}
return false;
}
}
});
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel