Ticket Q149872
Visible to All Users

Client-side changes getting wiped out when node is expanded

created 16 years ago

I have a TreeList with five columns. All of the data is read-only except for certain fields in the second column that the user can modify. When the user makes any changes in the second column (on keypress), I need to immediately (i.e. client-side) delete all the values in the fourth and fifth columns, and also reset the cell shading in those columns to their default colors. A coworker of mine was able to write a JQuery/Javascript function that accomplishes this nicely. However, whenever you expand a node somewhere else in the TreeList, then the fourth and fifth columns are restored to their previous values and cell shading -- which is obviously not what we want. These columns should not be updated until the user clicks a separate Calculate button outside of the TreeList that initiates a full postback. All the values are calculated server-side. The idea is that the data in the fourth and fifth columns is no longer valid if the user makes any changes, and so it should be deleted until the user recalculates. Our TreeList is bound to a datatable on the server side.
I basically have two questions:

  1. Is there a preferred way, using some internal events or other built-in capability of the TreeList, to accomplish the clearing and re-shading of these two columns?
  2. Can we prevent the TreeList from restoring the values that we erased (client-side) whenever a node is expanded?
    Thanks.
Show previous comments (1)

    Well, I got it working by clearing the client-side and then clearing the server-side data the next time it posts back. Everything works perfectly in IE, but in Firefox and Safari, it seems that the number of <td> cells rendered for each node in the treeview changes after the initial load. For example, in a particular 1st-level node, I might have five td cells when the page is originally loaded, but then it will have seven upon postback. I'm not talking about the extra td's that are created to the left of the row when the node is expanded. It just seems to add a couple of columns in the HTML, or at least in the Javascript/JQuery object model, and this causes the wrong columns to be affected. Is there something I should know that might be causing this behavior only in Firefox and Safari?
    Is there a preferred way to clear out two columns on the client side? I'm trying to duplicate this server-side code on the client:
                foreach (TreeListNode tln in TreeList1.Nodes)
                {
                    if (tln.Level == 1)
                    {
                        tln.SetValue("Weight1", DBNull.Value);
                        tln.SetValue("Weight2", DBNull.Value);
                        //I also need to set the background color of the node, but that doesn't seem to be possible either
                        //server-side, or client-side. How would I do that?
                    }
                }

    DevExpress Support Team 16 years ago

      Hi Ken:
      I suggest you to check the example attached. This example is created for the ASPxGridView, but I believe that you can implement the similar approach for the ASPxTreeList.
      Thanks
      Kate.

        Thanks Kate. Unfortunately, I did not purchase the ASPxGridView, so I cannot run the sample. My current question has sort of evolved from its original form, so I will post it separately as "How to clear columns client-side."
        Thanks.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.