Author: bobby Date: Thu Mar 14 16:57:10 2013 New Revision: 1456537 URL: http://svn.apache.org/r1456537 Log: svn merge -c 1456536 FIXES: YARN-237. Refreshing the RM page forgets how many rows I had in my Datatables (jian he via bobby)
Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/view/JQueryUI.java Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt?rev=1456537&r1=1456536&r2=1456537&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt (original) +++ hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt Thu Mar 14 16:57:10 2013 @@ -21,6 +21,9 @@ Release 2.0.5-beta - UNRELEASED YARN-198. Added a link to RM pages from the NodeManager web app. (Jian He via vinodkv) + YARN-237. Refreshing the RM page forgets how many rows I had in my + Datatables (jian he via bobby) + OPTIMIZATIONS BUG FIXES Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/view/JQueryUI.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/view/JQueryUI.java?rev=1456537&r1=1456536&r2=1456537&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/view/JQueryUI.java (original) +++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/view/JQueryUI.java Thu Mar 14 16:57:10 2013 @@ -107,12 +107,21 @@ public class JQueryUI extends HtmlBlock protected void initDataTables(List<String> list) { String defaultInit = "{bJQueryUI: true, sPaginationType: 'full_numbers'}"; + String stateSaveInit = "bStateSave : true, " + + "\"fnStateSave\": function (oSettings, oData) { " + + "sessionStorage.setItem( oSettings.sTableId, JSON.stringify(oData) ); }, " + + "\"fnStateLoad\": function (oSettings) { " + + "return JSON.parse( sessionStorage.getItem(oSettings.sTableId) );}, "; + for (String id : split($(DATATABLES_ID))) { if (Html.isValidId(id)) { String init = $(initID(DATATABLES, id)); if (init.isEmpty()) { init = defaultInit; } + // for inserting stateSaveInit + int pos = init.indexOf('{') + 1; + init = new StringBuffer(init).insert(pos, stateSaveInit).toString(); list.add(join(id,"DataTable = $('#", id, "').dataTable(", init, ").fnSetFilteringDelay(188);")); String postInit = $(postInitID(DATATABLES, id)); @@ -126,9 +135,12 @@ public class JQueryUI extends HtmlBlock String init = $(initSelector(DATATABLES)); if (init.isEmpty()) { init = defaultInit; - } + } + int pos = init.indexOf('{') + 1; + init = new StringBuffer(init).insert(pos, stateSaveInit).toString(); list.add(join(" $('", escapeJavaScript(selector), "').dataTable(", init, - ").fnSetFilteringDelay(288);")); + ").fnSetFilteringDelay(288);")); + } }