From b0b69aab45118474421c5b98ec9597a52ed6d027 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Mon, 26 Aug 2013 12:44:13 +0200 Subject: [PATCH] Bug #2209: Get ID from first column of datatable if not present in second (cherry picked from commit 804f7a84e45c3b058fe28843fae45680565654f7) --- src/sunstone/public/js/sunstone-util.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/sunstone/public/js/sunstone-util.js b/src/sunstone/public/js/sunstone-util.js index 8df21114d8..73a4d6a06c 100644 --- a/src/sunstone/public/js/sunstone-util.js +++ b/src/sunstone/public/js/sunstone-util.js @@ -208,13 +208,21 @@ function tableCheckboxesListener(dataTable, custom_context){ // Does a partial redraw, so the filter and pagination are kept function updateView(item_list,dataTable){ var selected_row_id = $($('td.markrowselected',dataTable.fnGetNodes())[1]).html(); + if (!selected_row_id) selected_row_id = $($('td.markrowselected',dataTable.fnGetNodes())[0]).html(); var checked_row_ids = new Array(); $.each($(dataTable.fnGetNodes()), function(){ - if($('td.markrowchecked',this).length!=0) - { - checked_row_ids.push($($('td',$(this))[1]).html()); - } + if($('td.markrowchecked',this).length!=0) + { + if (!isNaN($($('td',$(this))[1]).html())) + { + checked_row_ids.push($($('td',$(this))[1]).html()); + } + else + { + checked_row_ids.push($($('td',$(this))[0]).html()); + } + } }); if (dataTable) { @@ -252,6 +260,12 @@ function updateView(item_list,dataTable){ { $.each($(dataTable.fnGetNodes()),function(){ var current_id = $($('td',this)[1]).html(); + + if (isNaN(current_id)) + { + current_id = $($('td',this)[0]).html(); + } + if (current_id) { if(jQuery.inArray(current_id, checked_row_ids)!=-1)