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

    ListGrid.addViewStateChangedHandler(...) vs ListGrid.addFieldStateChangedHandler(...)

    Hi Isomorphic,

    SmartClient Version: v12.1p_2023-04-07/Pro Deployment (built 2023-04-07)

    We have some logic in our FieldStateChangedHandler that we recall getting executed when we updated the ViewState of the list grid, however, we notice that this is not the case currently.

    We also notice there is a specific ViewStateChangedHandler for ViewStateChangedEvent's.

    Couple quick questions.

    a) Is there a case where both a FieldStateChanged event and a ViewStateChangedEvent event will be fired for the same action, such as setting the ViewState?

    Or does setting the ViewState only fire a ViewStateChangedEvent?

    What about setting the SelectedState?

    b) Was there always a ViewStateChangedHandler or did that get introduced later? Was there any changes around when a FieldStateChanged is fired vs. when a ViewStateChangedEvent is fired?

    Thank you

    a) yes. FieldStateChanged basically fires in a subset of cases where ViewStateChanged fires, because the ViewState includes the fieldState

    b) ViewStateChanged was added 3/21/2011, so it's rather old. FieldStateChaneged is even older: 12/27/2006. Both changes probably pre-date your first introduction to the framework, but no, there was no specific intent to change how FieldStateChanged fires when ViewStateChanged was introduced. It still has its original purpose of allowing a developer to react to changes such as field order, field size and so forth.


      OK, thank you for the information.

      We will have to look closer here because we do see the ViewStateChanged being fired when the view state is being set programmatically, however, setting this view state results in the visible fields changing, yet, we do not see the FieldStateChanged event being fired in this case.


        Both events are intended to fire only when an end user makes a change to the visual configuration of the grid. So if you are seeing ViewStateChanged fire from a programmatic change, that's either a bug or some API you aren't meant to be calling!

        Please let us know if you can isolate what's going on, or if you have test code that reproduces the problem.


          Don't believe we are using anything undocumented here.

          As soon as we have the time, will try to isolate/investigate further and provide an update.