EasyUI Forum
October 18, 2025, 08:54:42 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: DataGrid with checkboxes  (Read 8514 times)
yamilbracho
Jr. Member
**
Posts: 64


View Profile Email
« on: June 08, 2015, 01:26:55 PM »

Hi
I have a combogrid and a datagrid with checkboxes and I would like, when i selected a option from the combo, the datagrid show the items selected for that particular value. My code  :

     $('#cc').combogrid({   
            onChange:function(newValue, oldValue) {
                console.log('newValue=' + newValue);
                $('#dg').datagrid('reload',{
                    id_canal : newValue
                });
            }
        });

In the url i recive the id_canal value and returns the items this way :

{"total":28,"rows":[{"ck":true,"id_clasificacion":1,"tx_clasificacion":"INDIVIDUALES"},{"ck":false,"id_clasificacion":2,"tx_clasificacion":"CUENTAS"},{"ck":false,"id_clasificacion":3,"tx_clasificacion":"PETSHOP"},{"ck":false,"id_clasificacion":4,"tx_clasificacion":"MEDICOS AFILIADOS MEDICHAT"},{"ck":false,"id_clasificacion":5,"tx_clasificacion":"NACIONALES"},{"ck":false,"id_clasificacion":6,"tx_clasificacion":"ASISTENCIA MEDICA A DOMC"},{"ck":false,"id_clasificacion":7,"tx_clasificacion":"REVISTA"},{"ck":false,"id_clasificacion":8,"tx_clasificacion":"SIN FINES DE LUCRO"},{"ck":false,"id_clasificacion":9,"tx_clasificacion":"TU DESCUENTON"},{"ck":false,"id_clasificacion":10,"tx_clasificacion":"COLECTIVO"}]}

and my datagrid definition is :

                <table id="dg"
                       title="Clasificacion"
                       class="easyui-datagrid"
                       style="width:550px;height:250px"
                       url = './clasificacion_canal/crud_clasificacion_canal.php?action=ARCL&id-canal=1'
                       idField="id_clasificacion"
                       pagination="true"
                       data-options="rownumbers : true"
                       iconCls="icon-save">
                    <thead>
                        <tr>
                            <th field="ck" checkbox="true"></th>
                            <th field="id_clasificacion" width="80">C&oacute;digo</th>
                            <th field="tx_clasificacion" width="500">Nombre</th>
                        </tr>
                    </thead>
                </table>               

I am not sure if the reload method is called because the checkboxes are not updated....

Any hint ?

Logged
yamilbracho
Jr. Member
**
Posts: 64


View Profile Email
« Reply #1 on: June 08, 2015, 01:47:15 PM »

I solved by myself!!!!
Just add onLoadSuccess event to my datagrid

Code:
   $('#dg').datagrid({
            onLoadSuccess:function() {
                var rows = $('#dg').datagrid('getRows');
                for (i = 0; i < rows.length; ++i) {
                    if (rows[i]['ck'] == 1) {
                        $(this).datagrid('checkRow', i);
                    }
                }           
            }
        });

Regards
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!