Announcement

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

    Problem with not firing DataChangedEvent

    Hi!
    I am working on refreshing of views based on ResultSet and i think i did hit a bug here. Can you confirmed ?
    Steps to reproduce:
    1.Right click on some record and select "Open in Window".
    2.Right click on ANOTHER record and select "Open in Window".
    3.Click on "update" button in window from step 1 -> DataChangedEvent is fired -> you can see, that SC console will pop-up
    4.Click on "update" button in window from step 2 -> DataChangedEvent is NOT fired -> NO SC console will pop-up
    5.After step 4 you can click on whichever "update" button, no DataChangedEvent will be fired

    Is this a bug ? If yes, can you please fix it ?

    Tested with Firefox 20.0.1 and http://smartclient.com/builds/SmartG...GPL/2013-08-18

    Thank you
    Attached Files

    #2
    This looks like quite an odd usage, and it's not entirely clear what the expected behavior here would be. For example you're creating a new ResultSet for each window, and destroying the previous one, so presumably if you open more than one window you end up with some destroyed resultSets.
    You're also populating the "allRows" cache with a single record.
    When you call "updateData()" on the dataSource, you're also not passing in any changes, just the primary key for the record.

    If you can you explain you're actual use case and how this is breaking in your application we'll have a better picture of what's going on and whether there's a real meaningful framework error vs an application design issue, etc

    Thanks
    Isomorphic Software

    Comment


      #3
      Originally posted by Isomorphic View Post
      If you can you explain you're actual use case and how this is breaking in your application we'll have a better picture of what's going on and whether there's a real meaningful framework error vs an application design issue, etc

      Thanks
      Isomorphic Software
      My use case is following: User is able to open new window or new tab with details of whichever row in the grid. Since these details can be visible on more places i want to use ResultSet everywhere where i need to refresh already opened details. So usually i am creating ResultSet which is containing only one record (specific for certain record opened in tab or window). And in onDataChanged method i am doing the actual refresh of details. Or do you have some other proposal how to do it better ?

      But still, dont you think that DataChangedEvent should be fired always after some operation on DS was executed. This is also how it is explained in your docs here: ResultSets observe any successful "update", "add" or "remove" dsRequests against their DataSource, regardless of the component that initiated them.
      Last edited by geletkaf; 1 Sep 2013, 23:59.

      Comment


        #4
        Your basic approach of using a ResultSet to be notified when a DataSource update operation changes some record or set of records should work. Setting the "allRows" cache to the single record that you care about is an unusual usage. It basically is telling the ResultSet that that single record is the only record in the DataSource, so if you change criteria, the resultSet will show no data even though there actually is data in the DataSource.
        Rather than setting this property, you should probably make use of the "initialData" attribute, which is intended to populate the ResultSet's initial set of data that matches its initial criteria.

        Regardless, having spent some more time with the example we agree there was a bug where dataChanged was failing to fire as expected. We've now resolved this issue. Please try the next nightly build

        Regards
        Isomorphic Software

        Comment


          #5
          Issue was fixed with SmartClient Version: v8.3p_2013-09-05/LGPL Development Only (built 2013-09-05). thanks

          Comment


            #6
            Observing remove operation with ResultSet and onDataChanged

            Hi,
            my use case is the same as the one already described earlier above. Again record in grid can be open in new window or tab. I am using ResultSet to observe changes... My question is following: can i somehow distinguish in onDataChanged method which operation was executed on DataSource ? The reason for this is, when the executed operation was remove (so the record from grid should disappear) i would like to close all related tabs and windows.

            Thank you

            EDIT:
            My collegue adviced me one solution which is working with just basic checking if cache of ResultSet is empty or not. If its empty, i have a garantee that remove operation was executed. This is working fine, when only one window is open. I prepared a showcase (AutofitFilterSample ) where you can see, when this solution is not working.
            STEPS TO REPRODUCE:
            1. Open 3 new windows of 3 different records in the grid.
            2. One by one start pressing update button in each of these windows.
            3. You can see that all resultsets of all windows are trying to be synchronyze.

            Is this the correct behaviour ? I thought, that when I set the Criteria on ResultSet, it should not include those records which are not fitting in it. In this case are Criteria constructed with the PK. So I would except that every ResultSet would keep only one record. Only after executing of the remove operation it should be empty. Can you explain me what i am doing wrong, or if i am correct, can you fix this ?

            EDIT #2:
            When I set the data for ResultSet with call
            Code:
            resultSet.setInitialData(new Record[] { record });
            things start to work :)
            Attached Files
            Last edited by geletkaf; 25 Sep 2013, 06:21.

            Comment


              #7
              Given your last edit, it sounds like things are now working for you? If not, please let us know!

              Comment

              Working...
              X