Announcement

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

    Prevent ListGrid from auto retrieve data

    Is there any way to prevent ListGrid to fetch data from server?

    I know setSaveLocally can do the job but it cannot modify after the grid is initialized.

    #2
    It's not clear what you're trying to do - setSaveLocally() prevents data from being pushed *to* the server - when you want to commit your changes, you can do so on demand via saveAllEdits().

    But if you want to prevent fetching *from* the server, just setAutoFetchData(false) on the grid and populate it yourself with fetchData().

    Comment


      #3
      E.g.

      I have 2 windows which contains ListGrid with same dataSource.

      ListGrid in Window A has only one row with editing a Record.
      ListGrid inWindow B has only one row editing another new Record.

      After the ListGrid is saved in Window A, the ListGrid in Window B appears to have 2 rows, one is the new editing record and a Record saved in Window A is populated in the grid too.

      Comment


        #4
        This suggests that the grids are setAutoFetchData(true) and/or that the new record saved from windowA fits the criteria for the grid in windowB.

        If that doesn't help, please show the code for the grids.

        Comment


          #5
          I didn't setAutoFetch and no initialCriteria in both grid!!

          Here is the code:
          ListGrid gridA = new ListGrid();
          gridA.setDataSource(FWDataSourceList.getOrCreateRef("PURCHASE_PRODUCT"));
          gridA.setWidth100();
          gridA.setHeight100();


          ListGrid gridB = new ListGrid();
          gridB.setDataSource(FWDataSourceList.getOrCreateRef("PURCHASE_PRODUCT"));
          gridB.setWidth100();
          gridB.setHeight100();


          Window winA = new Window();
          winA.addItem(gridA);
          winA.show();

          Window winB = new Window();
          winB.addItem(gridB);
          winB.show();

          Record recordA = new Record();
          recordA.setAttribute("PURCHASE_ID", 166);
          gridA.startEditingNew(recordA);

          Record recordB = = new Record();
          recordB.setAttribute("PURCHASE_ID", 166);
          gridB.startEditingNew(recordB);

          Comment

          Working...
          X