1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

Fixes feature #543: Improve check all handling.

Check/Uncheck-all now only take into account the elements which are
visible. Same for the getCheckedElements() function. So actions will only
apply to visible elements.
This commit is contained in:
Hector Sanjuan 2011-04-01 02:05:15 +02:00 committed by Jaime Melis
parent 77e5f4f760
commit d9db42e40d

View File

@ -94,14 +94,16 @@ function tableCheckboxesListener(dataTable){
};
$('.create_dialog_button',context).button("enable");
//listen to changes
$('input',dataTable).live("change",function(){
var dataTable = $(this).parents('table').dataTable();
var context = dataTable.parents('form');
var last_action_b = $('.last_action_button',context);
var nodes = dataTable.fnGetNodes();
//listen to changes in the visible inputs
$('tbody input',dataTable).live("change",function(){
var table = $(this).parents('tbody');
var context = table.parents('form');
var nodes = $('tr',table);
var total_length = nodes.length;
var checked_length = $('input:checked',nodes).length;
var checked_length = $('input:checked',nodes).length;
var last_action_b = $('.last_action_button',context);
//if all elements are checked we check the check-all box
if (total_length == checked_length && total_length != 0){
@ -365,7 +367,7 @@ function getSelectedNodes(dataTable){
var selected_nodes = [];
if (dataTable != null){
//Which rows of the datatable are checked?
var nodes = $('input:checked',dataTable.fnGetNodes());
var nodes = $('input:checked',$('tbody',dataTable));
$.each(nodes,function(){
selected_nodes.push($(this).val());
});