Zen Table pane: Can I update a row in the table pane?
I am able to display my query result in the table pane, but I want to update it based on user click but it doesnt work. Can this be done? Below is what I am doing but it doesnt change my value on clicking. Would appreciate some guidance on this
I have ondblclick = zenPage.SelectItem
{
table = this.getComponentById('tablename');
var data = table.selectedIndex;
var rowval = table.getRowData(data);
var valuep = new zenProxy();
valuep.TXTFLAG = rowval["TEXT"];
zenPage.ToggleTextFlag(pP);
var table = this.getComponentById('tablename');
table.executeQuery();
}
ClassMethod ToggleTextFlag(bData As %ZEN.proxyObject, act As %String) As %Boolean [ ZenMethod ]
{
if bData.TXTFLAG = "Y"
{
s bData.TXTFLAG = "N"
}
else
{
s bData.TXTFLAG = "Y"
}
Set tSC = 0
Quit tSC
}
Here's how I'd typically do something like that, going back to my example from one of your earlier questions and expanding a bit. The persistent class as a new %Boolean property named "Toggleable" (not a magical name - you can call it whatever you like), and the tablePane has <column> elements added. The query supplying data for the table has the ID and Toggleable columns added as well. The "Toggleable" column has OnDrawCell defined to provide custom HTML for the cells in the table; this references an ObjectScript method (which doesn't need to be, and in fact shouldn't be, a ZenMethod). That ObjectScript method renders HTML which calls a ZenMethod to actually do the update, using query results from the %query variable (which is a special thing that's available for use in OnDrawCell). No table refresh is needed, but if you refresh the page you'll see that the checkbox values have indeed been persisted.
Here's the Zen XData change:
And corresponding ObjectScript methods:
Here's the full sample:
Thank You Timothy, for kindly taking the time to guide me. so clear explaination. Thank you