Author: pgolawski
Date: 2008-07-30 03:25:11 -0400 (Wed, 30 Jul 2008)
New Revision: 9821
Modified:
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/TableDragDropRenderer.java
Log:
delete existing JS variable before creating new
Modified:
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/TableDragDropRenderer.java
===================================================================
---
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/TableDragDropRenderer.java 2008-07-30
07:23:41 UTC (rev 9820)
+++
trunk/sandbox/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/html/TableDragDropRenderer.java 2008-07-30
07:25:11 UTC (rev 9821)
@@ -48,7 +48,7 @@
private JSFunction preSendAjaxRequestFunction;
- private TableDragDropRenderer(FacesContext context) {
+ private TableDragDropRenderer(FacesContext context) {
super();
this.context = context;
}
@@ -109,7 +109,8 @@
*/
public void renderDragSupport(UIColumn column, String dragSourceId,
String indicatorId, String dragLabel) throws IOException {
- StringBuffer buffer = new StringBuffer();
+ String varName =
"DnD_ExtSimpleDraggable_"+column.getId().replaceAll("[^A-Za-z0-9_]",
"_");
+ StringBuffer buffer = new StringBuffer("delete " + varName +
";\nvar " + varName + " = ");
JSFunction function = new JSFunction("new DnD.ExtSimpleDraggable");
function.addParameter(dragSourceId);
String dragSourceScriptId = column.getClientId(context) + ":"
@@ -161,7 +162,8 @@
// DropzoneRendererContributor.getInstance();
DropzoneRendererContributor contributor = DropzoneRendererContributor
.getInstance();
- StringBuffer buffer = new StringBuffer();
+ String varName =
"DnD_ExtSimpleDropZone_"+column.getId().replaceAll("[^A-Za-z0-9_]",
"_") + (before?"L":"R");
+ StringBuffer buffer = new StringBuffer("delete " + varName +
";\nvar " + varName + " = ");
JSFunction function = new JSFunction("new DnD.ExtSimpleDropZone");
function.addParameter(dropTargetId);
ScriptOptions dropOptions = contributor.buildOptions(context, column);