1. #1
    Ext User
    Join Date
    Sep 2010
    Posts
    3
    Vote Rating
    0
    stellit is on a distinguished road

      0  

    Question Cannot add new row to grid using ListStore

    Cannot add new row to grid using ListStore


    Hi there,

    I'm trying to add a new model to grid using ListStore, but I cannot add new row into grid.
    I use following code to create a grid.
    Code:
    private Grid<BaseModelData>createGrid() {
    	ListStore<BaseModelData> store = new ListStore<BaseModelData>();
    	return new EditorGrid<BaseModelData>(store, createCoolumnModel());
    }
    private ColumnModel createReachabilityColumnModel() {
    	List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
    	configs.add(new ColumnConfig("priority", "", 30));
    	configs.add(new ColumnConfig("type", "Type", 100));
    	return new ColumnModel(configs);
    }
    after grid rendered, I use the following code to add new row into grid.
    Code:
    BaseModelData data = new BaseModelData();
    data.set("priority", 1);
    data.set("type", "Normal");
    grid.getStore().insert(data, store.getCount());
    I notice that, this model was successfully added into store, but it does not show in grid at all.

    Any advice?

    Thanks
    Regards,
    Stellit
    Last edited by stellit; 25 Oct 2010 at 9:59 AM. Reason: correct instance name

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    What is "reach"? You called your new instance "data".

  3. #3
    Ext User
    Join Date
    Sep 2010
    Posts
    3
    Vote Rating
    0
    stellit is on a distinguished road

      0  

    Default


    Oops, I mean "data"...
    Edited

  4. #4
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    And it is still not working? Can you plesae post your code in a small and standalone testcase that implements EntryPoint?

  5. #5
    Ext User
    Join Date
    Sep 2010
    Posts
    3
    Vote Rating
    0
    stellit is on a distinguished road

      0  

    Default


    Ok, just figured out the problem. the code is correct, works also in a empty entrypoint.
    but if I put the code in to a window, or any panel within that window.
    than insert does not work at all.

  6. #6
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    I doubt that this is the case. Can you plesae post your code as a small, standalone testcase, including the window?

Similar Threads

  1. [CLOSED] grid issue when add diferent class to listStore
    By fother in forum Ext GWT: Bugs (1.x)
    Replies: 19
    Last Post: 22 Dec 2008, 7:16 AM
  2. add new row to grid doesnt fire add event
    By fxmisticat in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 22 Nov 2008, 10:19 AM

Thread Participants: 1