EasyUI Forum

General Category => General Discussion => Topic started by: ryupanqui on December 17, 2013, 08:25:10 AM



Title: getChecked method on Treegrid
Post by: ryupanqui 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>


Title: Re: getChecked method on Treegrid
Post by: stworthy 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>


Title: Re: getChecked method on Treegrid
Post by: ryupanqui 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?


Title: Re: getChecked method on Treegrid
Post by: stworthy 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.


Title: Re: getChecked method on Treegrid
Post by: ryupanqui 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?


Title: Re: getChecked method on Treegrid
Post by: stworthy 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.


Title: Re: getChecked method on Treegrid
Post by: ryupanqui on December 19, 2013, 04:25:09 PM
It works fine now. Thanks!