EasyUI Forum
May 15, 2024, 01:30:55 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: getChecked method on Treegrid  (Read 16409 times)
ryupanqui
Newbie
*
Posts: 44


View Profile Email
« on: December 17, 2013, 08:25:10 AM »

i'm using the "getChecked" method in a treegrid but it's not return the correct checked rows when i check all or uncheck all rows on treegrid. How can i fix this issue?

My code is

Code:

<table id="tg" class="easyui-treegrid"
               data-options="fit:true,
                            striped:true,
                            nowrap:false,
                            pagination:false,
                            idField:'id',
                            treeField:'nombre',
                            rownumbers:true,
                            checkOnSelect:false,
                            singleSelect: false,
                            fitColumns:true">
    <thead>
        <tr>
            <th data-options="field:'check',checkbox: true"></th>
            <th data-options="field:'nombre',width:220,halign:'center',align:'left',sortable:false">Nombre</th>
            <th data-options="field:'descripcion',width:350,halign:'center',align:'left',sortable:false">Descripcion</th>
        </tr>
    </thead>
</table>
« Last Edit: December 17, 2013, 08:42:56 AM by ryupanqui » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: December 17, 2013, 05:23:59 PM »

Please override the 'getChecked' method for treegrid.
Code:
<script>
$.extend($.fn.treegrid.methods, {
getChecked:function(jq){
var rows = [];
var target = jq[0];
var opts = jq.treegrid('options');
opts.finder.getTr(target, '', 'checked').has('div.datagrid-cell-check input[type=checkbox]').each(function(){
var row = opts.finder.getRow(target, $(this));
rows.push(row);
});
return rows;
}
});
</script>
Logged
ryupanqui
Newbie
*
Posts: 44


View Profile Email
« Reply #2 on: December 17, 2013, 05:55:05 PM »

many thanks for your reply, but then, Is it correct the current behavior of "getChecked" method on treegrid? or are you planning update the library?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: December 17, 2013, 06:24:46 PM »

The updated datagrid and treegrid plugins are available from http://www.jeasyui.com/easyui/plugins/jquery.datagrid.js and http://www.jeasyui.com/easyui/plugins/jquery.treegrid.js. You also can download the whole easyui file from http://www.jeasyui.com/easyui/jquery.easyui.min.js that has fixed this issue.
Logged
ryupanqui
Newbie
*
Posts: 44


View Profile Email
« Reply #4 on: December 18, 2013, 10:30:07 AM »

excuse me, but i see that the plugins have been fixed and the jquery.easyui.min.js file has not been fixed yet. can you check that file?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #5 on: December 18, 2013, 05:23:06 PM »

The 'jquery.easyui.min.js' file has been fixed. Please check your code carefully. When using 'jquery.easyui.min.js' file, be sure to use the corresponding 'easyui.css' file, it can be download from http://www.jeasyui.com/easyui/themes/default/easyui.css.
Logged
ryupanqui
Newbie
*
Posts: 44


View Profile Email
« Reply #6 on: December 19, 2013, 04:25:09 PM »

It works fine now. Thanks!
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!