Loading ...
Sorry, an error occurred while loading the content.

How do I change the checkbox value from the label in YUI Treeview using TaskNode

Expand Messages
  • xixbenjaminxix
    I need to pass check box information in a form using the YUI Treeview. I ve set up to use the TaskNodes per the example on
    Message 1 of 2 , Jun 2, 2009
    • 0 Attachment
      I need to pass check box information in a form using the YUI Treeview. I've set up to use the TaskNodes per the example on http://developer.yahoo.com/yui/examples/... but need to customize the check box's value to use a value that is not the label's value as the labels could potentially have the same value on multiple nodes.

      Currently, in my post request, the value passed for the check box is the label. I've tried setting the following to no avail as it continues using the label as the checkbox's value when passed in the form:

      myobj = { label: "subname", id:"subcatid" };
      var tmpNode = new YAHOO.widget.TaskNode(myobj, firstNode, false, false);

      Any help would be appreciated.

      Thanks,
      Ben
    • Satyam
      As of 2.7.0, the TreeView control already supports the functionality of the TaskNode example in all of its nodes. It is referred to as node highlighting and
      Message 2 of 2 , Jun 3, 2009
      • 0 Attachment
        As of 2.7.0, the TreeView control already supports the functionality of
        the TaskNode example in all of its nodes. It is referred to as node
        highlighting and via CSS styles, that highlight can be presented as
        checkboxes via suitable background images. Unfortunately, the examples
        for this functionality didn't get into the YUI site so I have placed
        them in:

        http://satyam.com.ar/yui/2.7.0/tasklist.html

        You will notice that it loads its own copy of the TreeView library. The
        released version had some bugs and the stylesheet wasn't deployed
        correctly so you will be better off downloading a copy of the treeview
        files from GitHub, in the /build folder, both the JavaScript files as
        well as all the files in the /build/treeview/assets/skins/sam. The
        actual URL changes depending on the most recent commit so you'll have to
        travel the path yourself starting from:

        http://github.com/yui/yui2/tree/master

        In the example, you will see how the checked boxes can be fetched, in
        this case, they are listed to the logger and the property listed is the
        label. However, you could list any other property, even custom
        properties. You don't really want to change the properties that
        TreeView actually uses with your custom information. TreeView already
        uses an id it generates itself and you don't want to tamper with that
        one. It is better that you use a custom property such as "myId" or
        "subcatid" or whatever. In such cases, once you get the nodes list as
        shown in the example, you can access it as:

        hiLit[i].data.myId

        Satyam

        xixbenjaminxix escribió:
        > I need to pass check box information in a form using the YUI Treeview. I've set up to use the TaskNodes per the example on http://developer.yahoo.com/yui/examples/... but need to customize the check box's value to use a value that is not the label's value as the labels could potentially have the same value on multiple nodes.
        >
        > Currently, in my post request, the value passed for the check box is the label. I've tried setting the following to no avail as it continues using the label as the checkbox's value when passed in the form:
        >
        > myobj = { label: "subname", id:"subcatid" };
        > var tmpNode = new YAHOO.widget.TaskNode(myobj, firstNode, false, false);
        >
        > Any help would be appreciated.
        >
        > Thanks,
        > Ben
        >
        >
        >
        > ------------------------------------
        >
        > Yahoo! Groups Links
        >
        >
        >
        > ------------------------------------------------------------------------
        >
        >
        > No virus found in this incoming message.
        > Checked by AVG - www.avg.com
        > Version: 8.5.339 / Virus Database: 270.12.50/2150 - Release Date: 06/02/09 06:47:00
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.