EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: sectioni on October 28, 2018, 12:05:36 PM



Title: Checkbox issue with multiple datagrids (old easyUI version)
Post by: sectioni on October 28, 2018, 12:05:36 PM
Hi,

I have a system with easyUI 1.5.1
I have styled it's checkboxes using the <label for="..."> css trick. (i've added a label element to your core)

When i have a page with a datagrid, and then i open a Modal with another datagrid, checking a checkbox in the Modal causes the checkbox to get checked in the datagrid underneath.
That's because both checkboxes have the same ID. (i.e. ck_2)

This issue does not reproduce with easyUI 1.6.2 since the ID of the second datagrid (in the Modal) is 'ck-1_2'.

So I'm assuming you've fixed it at some point.

Can you give me the specific code fix for that? Because I can't upgrade the framework on that system due to QA issues.

Thanks



Title: Re: Checkbox issue with multiple datagrids (old easyUI version)
Post by: stworthy on October 28, 2018, 05:11:10 PM
I have styled it's checkboxes using the <label for="..."> css trick. (i've added a label element to your core)

The checkboxes in the datagrid have no 'id' attribute. Could you please show an example to demonstrate your issue?


Title: Re: Checkbox issue with multiple datagrids (old easyUI version)
Post by: sectioni on October 29, 2018, 04:58:18 AM
You're right.
It appears one of our developers added it using:

id="' + field + '_' + rowIndex + '"

inside:
renderRow: function(target, fields, frozen, rowIndex, rowData)

so for some reason rowIndex in 1.6.2 knows how to handle a situation with mulitple grids in the dom and 1.5.1 doesn't.

is there a way for me to add this fix to 1.5.1?


Title: Re: Checkbox issue with multiple datagrids (old easyUI version)
Post by: stworthy on October 29, 2018, 04:58:27 PM
Please try to call this statement to generate the id value.
Code:
var id = $(target).data('datagrid').rowIdPrefix+'-'+field+'-'+rowIndex;


Title: Re: Checkbox issue with multiple datagrids (old easyUI version)
Post by: sectioni on October 31, 2018, 10:14:37 AM
works. thanks