Radios in Treetable

Hi,

http://webix.com/snippet/7e49a657

I would like to make treetable or tree, where user can select dimensions and based on dimensions he will get some result. I am facing now with following problems:

  1. Parent radio needs to be disabled or removed. I would like to force child selection
  2. When child radio is selected then cell data is changed to radio state (0 or 1). How can I keep original data separate than radio status
  3. Every parent is for themself. So, I would like to allow user to select one vehicle and one market (from snippet). In current snippet all radios are connected. I believe that they share same name and javascript recognize them as one collection.

(1) you can use template function where place all necessary logic

(2) common.radio() is designed to be used in the separate column, that is why it changes value of its column

http://webix.com/snippet/3aadb430

(3) yep, you are right. In your case there are two ways

  • use checkboxes instead ( it will require some extra logic in oncheck, to handle if any other checkbox in the same group already checked )

  • implement you own radio buttons - instead of common radio you can place native input@type=radio tag in the template. And onItemClick handler to change the item’s state

Thank you Maksim,

I changed radio to checkbox because it is easier to work with them and I just do not know how to apply event onItemClick.

Every time user selects or deselects some checkbox I would like to triger function. Is it possible

http://webix.com/snippet/db4801ad

Yes, it’s possible with the help on an onCheck event:

on:{
   'onCheck':function(id, column, state){
        webix.message(id+" changed state to "+state)
    }
} 

http://webix.com/snippet/10550e7b

1 Like

Thank you. You saved my day :slight_smile: