3.0.5

Conditional Click Action With Multiple Selection

I'm trying to make a condition for the grid to open a window if a row is selected, but take no action if more than one row is selected (or if no rows are selected). I tried the selection count Property but that seems to execute after the click action, so its behind. This is what I have:

obj.setAction("click", function(src){
    var i = src.getProperty("item/index");
    if(obj.getSelectionProperty("count") == 1){
    window.open("preview.php?msg_id="+this.getDataProperty("text", i, 5),"preview");
    }
    });


As I said, this is always behind. For example, if I have one row selected, the condition will evaulate to true the NEXT click I make, regardless of what it is seeing as the previous count was 1.

Any help you could provide would be a miracle. I've pulled my hair out too long on this issue.

Thanks!
Dan
July 8,
Selection is updated in response to click action (this is bad design on my side), so you should either introduce a delay or assign your handler to 'selectionChanged' action:

obj.setAction("selectionChanged", myFunction);

http://www.activewidgets.com/grid.howto.select/overview.html

Alex (ActiveWidgets)
July 8,

This topic is archived.

See also:


Back to support forum