Announcement

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

    ListGrid lost selection

    Hi,

    From the following of your examples ...

    Feature Explorer -> Grids -> Data operations -> Databound update

    I noticed that the ListGrid selection gets lost following an updateData() method call.

    Is there any way to preserve listGrid selections upon underlying data source operations,
    whichever they are and wherever they take place (whether on the ListGrid it self or any
    other data bound object which may also update the underlying bound data) ?

    Thanks,

    #2
    The last requirement (any databound component - here we're assuming *in the same page* as opposed to cross-browser) would necessitate the following approach:

    1. keep a list of components that are bound to a given DataSource

    2. implement transformRequest to store off the selections in all these components, presumably as a mapping from componentId to a list of primaryKey values

    3. use transformResponse to detect changes, and re-apply selections. Note that this may be slightly awkward as transformResponse is called before the component receives the response and drops the selection, so you would need to set a timer. An alternatives here would be using component-specific events (eg ListGrid.dataChanged).

    You can encapsulate this as a subclass of DataSource and of each DataBoundComponent, then use these subclasses consistently to get the behavior system-wide.

    Comment


      #3
      Emmm ... that sounds tedious ...

      I would have expected this to be basic functionality built into
      the framework. Thanks for your response, I'll further investigate
      the proposed approach.

      Kind regards,

      Comment


        #4
        It's very easy to do for a specific case of updating a record (use the updateData callback to re-select). We actually wouldn't recommend implementing the behavior you asked about - it's not clear that automatic re-selection is appropriate for all components for all kinds of updates. There can be actions triggered by re-selection that you don't want to do, including fetching related details or re-populating a related form when it would be better to blank it out. We think it's best to look at a given screen and think about what the user wants to do next after an update, then implement that.

        Comment


          #5
          Out of curiosity, from your item #1 (keep a list of components that are bound to a given DataSource),
          is there a place within the data source where I could centrally keep track of all data bound
          component references (to encapsulate that logic from within)?

          Thanks,

          Comment


            #6
            The DataBoundComponent is really the one taking action when it binds to the DataSource, not the DataSource. So a way to encapsulate this while keeping usage the same would be to override setDataSource() and then register the DBC on the DataSource.

            Comment


              #7
              Thanks, I'll investigate that approach.

              Comment

              Working...
              X