1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    19
    Answers
    1
    Vote Rating
    0
    p33t is on a distinguished road

      0  

    Default Unanswered: A more complete ListStoreEditor example

    Unanswered: A more complete ListStoreEditor example


    Can anyone point me to a complete ListStoreEditor example?

    I want to do editing of a grid within a form and the only example I can find is in 'Binding | List Property Binding'. Unfortunately it is not complete as the resulting object graph is never 'flushed' and displayed.

    I tried it myself but it isn't working properly. Specifically, when I am editing a table cell and I click 'Close' on the dialog (implicit save) the modifications from the active cell are not applied to the object graph until a short time later. Using ListStore.setAutoCommit(true) does not help and I am definitely doing an Editor.flush().

    I suspect the cell's "lost focus" event that triggers the commit is processed after the dialog's BeforeHideEvent. Is this a bug?

    Any suggestions or examples would be appreciated.

    [UPDATE] Turns out 3.0.0-rc2 fixes my problem. Also, the link above only points to a single file in my GWT learning project. The containing folder for learning forms may be more useful.
    Last edited by p33t; 18 Apr 2012 at 3:46 PM. Reason: Updated with solution and enhanced information.

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,732
    Answers
    109
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    Unfortunatly, it doesn't appear there is enough code in your sample to allow me to test it. I would suggest building a simple example that implements EntryPoint to make it easy for others to look at it and make suggestions.

    I made a quick change to the List Property Binding example - try this yourself, and see if you get the same issue:

    Code:
    public class ListPropertyBindingExample implements EntryPoint, IsWidget {
      interface Driver extends SimpleBeanEditorDriver<Person, PersonEditor> {}
      
      private Driver driver = GWT.create(Driver.class);
      
      @Override
      public Widget asWidget() {
        FramedPanel panel = new FramedPanel();
        panel.setHeadingText("Model with List Property");
        panel.setBodyBorder(false);
        panel.setWidth(400);
        panel.addStyleName("margin-10");
        
        PersonEditor personEditor = new PersonEditor();
        driver.initialize(personEditor);
        
        panel.setWidget(personEditor);
        panel.addButton(new TextButton("Save", new SelectHandler() {
          @Override
          public void onSelect(SelectEvent event) {
            Person p = driver.flush();
            Window.alert(p.getKids().get(0).getName() + " " + p.getKids().get(0).getAge());
          }
        }));
        
        Person person = new Person("Darrell Meyer", "Sencha Inc", "Ext GWT", "Washington, DC", 9.99);
    
        List<Kid> kids = new ArrayList<Kid>();
        kids.add(new Kid("Alec", 4, new DateWrapper(2004, 1, 1).asDate()));
        kids.add(new Kid("Lia", 2, new DateWrapper(2005, 1, 1).asDate()));
        kids.add(new Kid("Andrew", 1, new DateWrapper(2007, 1, 1).asDate()));
        person.setKids(kids);
        
        driver.edit(person);
        
        return panel;
      }
    
      @Override
      public void onModuleLoad() {
        RootPanel.get().add(this);
      }
    
    }
    The other classes in the example have been left the same, the only difference is the selection handler that flushes and immediately alerts the contents of the first row. This is working for me correctly with both 3.0.0-rc2 and svn trunk. I tested this by editing a row and went straight from that cell editor to the save button, without otherwise blurring the field.

  3. #3
    Sencha User
    Join Date
    Dec 2011
    Posts
    19
    Answers
    1
    Vote Rating
    0
    p33t is on a distinguished road

      0  

    Default SOLVED

    SOLVED


    Thank you Colin. You helped but more indirectly.

    I upgraded from rc to rc2 and it fixed the problem. Sorry for not pointing out I was using rc[1].

    I'll update my post to highlight more of my example. Specifically:
    - Entire GWT/GXT learning project
    - Editor learning folder

    Cheers,
    Pete

Thread Participants: 1

Tags for this Thread