1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    15
    Vote Rating
    0
    CHEM_Eugene is on a distinguished road

      0  

    Default Unanswered: GXT Grid with GridRowEditing and model keys

    Unanswered: GXT Grid with GridRowEditing and model keys


    Store can contain models with same key?

    I don't want store can contains equal models. But how I can change it?
    I have ADD button which adds to store new row with only one column filled. Grid doesn't forbid to add several same rows.
    Then user change model in GridRowEditing and after he clicks Save editable model shouldn't be added to store if equal model already exists.

  2. #2
    Sencha User
    Join Date
    May 2014
    Posts
    11
    Vote Rating
    0
    Answers
    1
    Andy King is on a distinguished road

      0  

    Default


    Do you have a single column (or group of columns) that uniquely identify a row in your database table? In my case I have a unique integer value for each row in a table. When a user adds a new row to a table I get a new unique integer from the server, and apply that value to the new row. Here's my "New" button code:
    Code:
    _contentPanel.addButton(new TextButton("New", new SelectHandler() {
      @Override
      public void onSelect(final SelectEvent event) {
        getRemoteService().getNextId("Person", 1, new AsyncCallback<Integer>() {
          @Override
          public void onFailure(final Throwable t) {
            ...
          }
          @Override
          public void onSuccess(final Integer id) {
            final Person person = new Person();
            person.setId(id);
            _gridEditing.cancelEditing();
            _listStore.add(0, person);
            final int row = _listStore.indexOf(person);
            _gridEditing.startEditing(new GridCell(row, 0));
          }
        });
      }
    }));

Thread Participants: 1

Tags for this Thread