Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ListGrid viewState shared between instances?

    Browser: Google Chrome Version 35.0.1916.153 m
    Version: v9.1p_2014-06-10/Enterprise Deployment

    Hi

    I'm trying to use your EditPane+EditNode (de)serialization mechanism in conjunction with instances of a custom subclass MyListGrid of ListGrid. I intend there to be a separate EditPane for each MyListGrid instance which is responsible for serializing all the state (data and viewState) of its sole MyListGrid instance. It must also be able to reincarnate a clone of this instance which is always in exactly the same state after reincarnation as the original was before. A reincarnation consists of the following three EditPane calls:

    var s11n = EditPane.serializeAllEditNodesAsJson()
    EditPane.destroyAll()
    EditPane.addPaletteNodesFromJSON(s11n)

    On the larger scale, the serialized strings s11n generated by each EditPane are stored together with other information in a larger JSON structure which is serialized independently using a custom technique. Changing that situation is not relevant to the current problem.

    My current problem is this: When I create two instances of MyListGrid, change the data and viewState (specifically, the column width) of one of them, and then reincarnate it, it appears to re-create the state (data and viewState) correctly.

    BUT the serialization string produced does not need to be configured by overriding MyListGrid.updateEditNode() to contain any information about the viewState in order for this to work.

    This seems to indicate that the viewState is somehow persisted elsewhere. That suspicion is supported by the fact that a subsequent test reincarnating the other instance of MyListGrid, without changing its state at all, causes its reincarnated clone also to take on the viewState of the first MyListGrid instance. This seems to indicate that a shared copy of the viewState of all instances of MyListGrid is somehow being persisted elsewhere.

    Essentially, I want all the state of each MyListGrid instance to be entirely governed by its own EditPane, and to be entirely separated from and independent of the state of any other MyListGrid instance. I assume this should be achieved by storing the viewState along with the data in the EditPane serialization. But I think I also need somehow to disable the behind-the-scenes sharing/overriding of viewState that seems to be happening, and I don't know how to do this.

    What do I need to do to accomplish my objective?

    Thanks

    #2
    All we've got is a prose description, but based on that prose description, you don't need to do anything other than what you're already doing.

    Instead, you seem to be trying to report a bug that viewState changes are somehow propagated between two ListGrids that are both in editMode.

    We've just run a quick test and we don't seem to be replicating this effect. We'd suggest you take a careful look at your code and see if you are somehow propagating the viewState yourself - if you decide it's really the framework doing it, then we just need a way to replicate the problem.

    Comment


      #3
      Hi

      I have extracted from my code a test (SCP_Forum4Test.{html,js} -- attached) which can at least execute standalone and demonstrates the problem I'm encountering. I've tried to make it minimal, but it is still quite long. Sorry about that.

      I am perhaps using your framework in this test in some ways you did not anticipate, but I need to be using it like this (at least for now), in order to integrate a use of your persistence mechanism with the rest of what we have done.

      I don't think that anything I am doing in the test code is causing the undesired behaviour. I think the problem is either a bug in your framework, or a lack of understanding on my part about how to configure it properly for this use case.
      Attached Files

      Comment


        #4
        Hi

        It turns out to be a configuration problem.

        I showed this to one of my colleagues shortly after posting it, and he solved the problem. It turns out that the fields property needed to be defined when an instance of MyListGrid is created in my Tester.actionCreateListGrid function instead of in the definition of the MyListGrid class. Additionally, fields, fieldState and viewState needed to be set as node properties in MyListGrid.updateEditNode

        I re-attach the edited standalone test to show what needed to change and demonstrate that it solves the problem.

        Sorry to have bothered you :)
        Attached Files

        Comment

        Working...
        X