Announcement

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

    Preventing ViewStateChanged from firing when checkbox is clicked in a ListGrid row.

    SmartClient Version: v9.0p_2013-11-03/PowerEdition
    Browsers: IE 7 -10, Chrome 32, probably others

    We are using the "viewStateChanged" property of ListGrid to capture any changes made to the grid (column widths, sort orders etc) and call a function to persist the new state to the database.

    In our List grid we have a checkBox as the first colum and generate is using the following property, selectionAppearance : "checkbox".

    We are seeing that if a user clicks on the header row checkBox or the checkBox in indiviudal rows the "viewStateChanged" is fired and making a server call which we do not want as we are not making any changes to the columns. Is there any way to identify this event (checkbox clicked) and prevent the server call ?

    Here is a sample of the code within the listGrid we have.

    selectionAppearance : "checkbox",
    viewStateChanged : function() {persistGridState(gridName);},

    #2
    Preventing ViewStateChanged from firing when checkbox is clicked in a ListGrid row.

    Wanted to add one more note on this issue.

    When I call the listGrid's getViewState() method I am seeing the view state as a String as opposed to the ListGridViewState Object as mentioned in the smartClient documentations.

    Comment


      #3
      viewState includes the selection state so it is correct for it to fire when the selection is changed. You can instead persist just the fieldState and sortState if that's what you want.

      Comment


        #4
        Note that selectedState is part of viewState so the event firing makes sense when the checkbox is clicked. Maybe you just need to capture fieldStateChanged.

        Comment

        Working...
        X