From: <df...@us...> - 2012-05-25 16:24:41
|
Revision: 4052 http://openutils.svn.sourceforge.net/openutils/?rev=4052&view=rev Author: dfghi Date: 2012-05-25 16:24:35 +0000 (Fri, 25 May 2012) Log Message: ----------- CONTROLS-47 Backport of r4050: Extended combobox to prevent value display in some cases. Revision Links: -------------- http://openutils.svn.sourceforge.net/openutils/?rev=4050&view=rev Modified Paths: -------------- magnoliamodules/branches/magnolia44/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/ComboGridColumnType.java magnoliamodules/branches/magnolia44/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/PipeComboBox.js Modified: magnoliamodules/branches/magnolia44/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/ComboGridColumnType.java =================================================================== --- magnoliamodules/branches/magnolia44/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/ComboGridColumnType.java 2012-05-25 16:16:57 UTC (rev 4051) +++ magnoliamodules/branches/magnolia44/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/configuration/ComboGridColumnType.java 2012-05-25 16:24:35 UTC (rev 4052) @@ -43,9 +43,20 @@ @Override public String getHeadSnippet() { - return "<script type=\"text/javascript\" src=\"" - + MgnlContext.getContextPath() - + "/.resources/controls/js/PipeComboBox.js\"></script>"; + StringBuilder result = new StringBuilder(super.getHeadSnippet()); + result.append("<script type=\"text/javascript\" src=\""); + result.append(MgnlContext.getContextPath()); + result.append("/.resources/controls/js/PipeComboBox.js\"></script>"); + // Combobox must be patched because of a bug. For reference, see: + // http://www.sencha.com/forum/showthread.php?17465-1.1.1-Local-ComboBox-data-store-filter-not-cleared-on-call-to-setValue%28%29 + result.append("var PatchedComboBox = Ext.extend(Ext.form.ComboBox, {"); + result.append(" setValue: function(v) {"); + result.append(" this.store.clearFilter();"); + result.append(" PatchedComboBox.superclass.setValue.call(this, v);"); + result.append(" }"); + result.append("});\n"); + result.append("</script>"); + return result.toString(); } /** @@ -89,7 +100,7 @@ column.put( "editor", "(function() { window.gridComboColumnTypeTmp = new " - + ("true".equals(String.valueOf(colMap.get("pipe"))) ? "PipeComboBox" : "fm.ComboBox") + + ("true".equals(String.valueOf(colMap.get("pipe"))) ? "PipeComboBox" : "PatchedComboBox") + "({" + StringUtils.join(options, ",") + "}); return new Ed(gridComboColumnTypeTmp); })()"); @@ -103,7 +114,7 @@ else { column.put("editor", "new Ed(new " - + ("true".equals(String.valueOf(colMap.get("pipe"))) ? "PipeComboBox" : "fm.ComboBox") + + ("true".equals(String.valueOf(colMap.get("pipe"))) ? "PipeComboBox" : "PatchedComboBox") + "({" + StringUtils.join(options, ",") + "}))"); Modified: magnoliamodules/branches/magnolia44/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/PipeComboBox.js =================================================================== --- magnoliamodules/branches/magnolia44/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/PipeComboBox.js 2012-05-25 16:16:57 UTC (rev 4051) +++ magnoliamodules/branches/magnolia44/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/PipeComboBox.js 2012-05-25 16:24:35 UTC (rev 4052) @@ -4,7 +4,14 @@ var v = PipeComboBox.superclass.getValue.call(this); return this.lastSelectionText + '|' + v; }, - + + // Combobox must be patched because of a bug. For reference, see: + // http://www.sencha.com/forum/showthread.php?17465-1.1.1-Local-ComboBox-data-store-filter-not-cleared-on-call-to-setValue%28%29 + setValue: function(v) { + this.store.clearFilter(); + PipeComboBox.superclass.setValue.call(this, v); + }, + findRecord : function(prop, value) { return PipeComboBox.superclass.findRecord.call(this, prop, value.replace(/^.*\|(.*)$/, '$1')); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |