EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: phreeman on July 29, 2013, 03:34:01 PM



Title: datagrid getChecked only returns last row
Post by: phreeman on July 29, 2013, 03:34:01 PM
In the datagrid documentation it states that the getChecked method "Return all rows where the checkbox has been checked. This method is available since version 1.3."

I have a datagrid with 3 rows checked (the number doesn't matter, just an illustration) and getData returns an object with .total = 3 and .rows = array of length 3. getChecked method only returns the last checked row (array of length 1 with data as object). My onCheckAll event iterates through each row and calls the checkRow method (which triggers the onCheckRow event). In this case only the first row is returned for getChecked as each row is selected.

Is this how it is suppose to work? If so, how can I get all rows that have been checked? I'm totaling a column from the datagrid, only if the row is checked, in a separate field in the form.

Thanks for your help.


Title: Re: datagrid getChecked only returns last row
Post by: stworthy on July 29, 2013, 07:30:07 PM
Please refer to this example http://jsfiddle.net/yHdnH/. Click the 'GetChecked' button on top of datagrid and you will see it alert the exact checked rows number.