EasyUI Forum
April 29, 2024, 11:17:05 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Checked data not being cleared on grid load...  (Read 11042 times)
2plus2
Jr. Member
**
Posts: 75


View Profile
« on: April 26, 2013, 05:47:45 PM »

Howdy...

I'm loading a grid with data on demand (via a combination of combobox selections) and the checked status is not being cleared when new data is loaded. My code:

Code:
                    $('#dgExample').datagrid({
                        url: '/admin/ajax.aspx?a=getFiltered&r=' + $('#Some_Id').val() + '&i=' + fooId,
                        onLoadSuccess: function (data) {
                            var stringOfIDs = "";
                            for (i = 0; i < data.rows.length; ++i) {
                                if (data.rows[i]['Selected'] == 1) {
                                    $(this).datagrid('checkRow', i);

                                    if (stringOfIDs.length > 0) { stringOfIDs+= ','; }
                                    stringOfIDs+= data.rows[i]['id'];
                                } else {
                                    $(this).datagrid('uncheckRow', i);
                                }
                            }
                            $('#IDList').val(stringOfIDs);
                        }
                    });

I'm returning "Selected" as a 1/0 in the JSON, and iterating over that checking and unchecking the rows as needed. At first I tried just looking for the "1"s and selecting the rows, but that wasn't unchecking and "existing" rows. Shouldn't the selected/checked state be cleared each time you load data into the data grid?

Also - is there anyway to have the load event look for "Selected" as a name / value pair and check the checkbox automatically ?
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!