Thanks! I'm getting close. Here's the top of my table class with the mixin
included:
qx.Class.define("kiosk_portal.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);
this.__reQueue = function()
{
var row_number = selection[0].minIndex;
var tableModel = that.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();
}
this._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;
} else {
return false;
}
},
this.setContextMenuHandler(1, this._contextMenuHandler);
....
It gets to there and throws an error:
Uncaught TypeError: Cannot set property '1' of null
What's the correct way to do this?
On Tue, Jun 19, 2012 at 6:43 PM, Derrell Lipman <
[email protected]> wrote:
> On Tue, Jun 19, 2012 at 6:14 PM, Scott Chapman <[email protected]> wrote:
>
>> Is there any examples of the correct use of mTableContextMenu? I can't
>> find any.
>
>
> The demobrowser example uses it:
> http://demo.qooxdoo.org/devel/demobrowser/index.html?qxenv:demobrowser.withTests:true#table~Table_Context_Menu.html
>
> There are a number of features of the mixin which are not used in that
> example, though, so it's worth looking at the mixin documentation (or
> better yet, the mixin source code) to see all of its features.
>
> Derrell
>
>
>>
>>
>> On Tue, Jun 19, 2012 at 5:29 AM, Derrell Lipman <
>> [email protected]> wrote:
>>
>>> Scott, have a look at qx.ui.table.MTableContextMenu which allows you to
>>> create a handler that generates the context menu.
>>>
>>> Note also that the act of right-clicking selects a row, so you may have
>>> some trouble doing things differently depending on whether or not a row is
>>> selected. You may need your own variables to track what "was" selected.
>>>
>>>
------------------------------------------------------------------------------
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