A.G.Progm.Enthusiast
A.G.Progm.Enthusiast

Reputation: 1010

How to get specific selection of checkbox from a popup datatable in Webix?

I have a popup data table in each row of a maintable with some checkboxes in it. I am selecting/checking items randomly by clicking the checkbox buttons for each row and printing the values checked with the help of Print button.

I am observing that only the last selection of checkbox buttons are overwriting all the earlier selections.

How can I get the appropriate selection of checkbox buttons corresponding to each row?

Snippet: https://snippet.webix.com/11irkt7o

Thanks.

Upvotes: 0

Views: 606

Answers (1)

Aquatic
Aquatic

Reputation: 5144

You code uses a single instance of popup table for each rows, so as result whey you are calling $$pt.eachRow you are itterating other the last active value, all previous values are lost.

The better solution will be to use click handler of close button, to get all checked rows and store that data in the master row

{view:"button", label:"Close", click:function(){ ids = collectCheckedRows($$('p_table')); $$('mytable').updateItem(selectedRow, { checked : ids }) this.getTopParentView().hide() }}

Now, to print all values you can use

$$('mytable').eachRow(function(id){ console.log(id, this.getItem(id).checked); });

Upvotes: 1

Related Questions