Hi Jesse,

I guess the far most easiest way to achieve this, is to change your local gridtext-component (in "lps/components/lz/gridtext.lzx"). You only need to override the "updateData()"-method in the gridtext's editbox and handle in that place your node-creation code.
For instance like that:
@@ -106,6 +106,15 @@
                         this.globalMouseDel = new LzDelegate( this,
"checkMouse" );
                         super.init();
+                    </method>
+                    <method name="updateData" >
+                        var ret = super.updateData();
+ + if (this.datapath.p == null) { + this.datapath.context.addNode("description", ret);//for a "description/text()" datapath
+                        }
+ + return ret;
                     </method>
                     <method name="applyData" args="d">
                         //because of the monkeying with init that this


Hello,

  In a databound grid, I want to use a <gridtext> for an "optional" node
in the dataset; ie. the gridtext datapath ("Description/text()") may not
match anything, and that's ok.  It works fine if there is a match, but
if there isn't for that row, I'd like to be able to create a node (the
Description) when text is entered.  Any clues how that can be done?

  Further info: in that case, when there's no matching node, trying to
enter text prints the error "setNodeText: p is null in Datapath ...".
I've tried doEnterDown() and various events to try to catch that and
create a node, but they don't "fire," I think due to that error.  I'm
using 4.0.11.

--
Jesse Norell
Kentec Communications, Inc.
jesse at kci.net <http://www.openlaszlo.org/mailman/listinfo/laszlo-user>

Reply via email to