Datatable := Select / Unselect

Hello,
I'm hoping someone might be able to help me get my head around something. With a Datatable, I'm trying to work out how to click a row to select it (default operation) but clicking the selected row again would unselect it. I'm trying to understand the timing of the event handlers to accomplish this, but so far my only option seemed to be trying to use the onItemClick handler, but by the time that fires the row is already selected, so it can't be used to trigger an this.isSelected(x) check. I thought I would ask as it seems such a "normal" operation but I could not find a discussion or reference to it anywhere.
Thanks for any pointers you may be able to provide
-SrvrSide.

Tagged:

Comments

  • Digging further through the forum entries I found this that seems to be doing what I'm after. Thought it might help letting people know

            ready: function(){
                this.on_click.webix_cell = function(e, id){
                    if(this.isSelected(id))
                        this.unselect(id)
                    else {
                        this.blockEvent();
                        this.unselectAll();
                        this.unblockEvent();
                        this.select(id,true)
                    }
                };
            },
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion