From 07ff69495bbb23dae1213b3b301da25ea7e9b851 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Thu, 9 Dec 2010 13:26:05 -0500 Subject: [PATCH] bug #3125624 Inline editing fails when just one row (fixed for LTR languages in horizontal and vertical modes) --- js/sql.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/js/sql.js b/js/sql.js index 57cb761236..97cc42f879 100644 --- a/js/sql.js +++ b/js/sql.js @@ -28,15 +28,23 @@ function getFieldName($this_field, disp_mode) { if(disp_mode == 'vertical') { var field_name = $this_field.siblings('th').find('a').text(); + // happens when just one row (headings contain no a) + if ("" == field_name) { + field_name = $this_field.siblings('th').text(); + } } else { var this_field_index = $this_field.index(); if(window.parent.text_dir == 'ltr') { // 4 columns to account for the checkbox, edit, delete and appended inline edit anchors but index is zero-based so substract 3 - var field_name = $this_field.parents('table').find('thead').find('th:nth('+ (this_field_index-3 )+') a').text(); + var field_name = $('#table_results').find('thead').find('th:nth('+ (this_field_index-3 )+') a').text(); + // happens when just one row (headings contain no a) + if ("" == field_name) { + field_name = $('#table_results').find('thead').find('th:nth('+ (this_field_index-3 )+')').text(); + } } else { - var field_name = $this_field.parents('table').find('thead').find('th:nth('+ this_field_index+') a').text(); + var field_name = $('#table_results').find('thead').find('th:nth('+ this_field_index+') a').text(); } } -- 2.11.4.GIT