Results 1 to 3 of 3

Thread: the insert of grid not work

  1. #1

    Default the insert of grid not work

    the insert not works. and i really can't figure out what's wrong... thanks very much.
    PHP Code:
    Ext.onReady(
    function()
    {
        
    IniTargetGrid();
        
    });

    function 
    IniTargetGrid()
    {
        var 
    targetRecord Ext.data.Record.create([
        {
    name:'col_id',type:'string'},
        {
    name:'col_book',type:'string'},
        {
    name:'col_chapter',type:'string'},
        {
    name:'col_target',type:'string'}
        ]);
        
        var 
    targetData=[['id0','book0','chapter0','target0']];
        
        var 
    targetStore = new Ext.data.Store({
            
    proxy:new Ext.data.MemoryProxy(targetData),
            
    reader:new Ext.data.ArrayReader({},targetRecord)
        });
        
        
    targetStore.load();
        

        var 
    targetCm = new Ext.grid.ColumnModel([
            new 
    Ext.grid.RowNumberer(),
            {
    header:'book',dataIndex:'col_book'},
            {
    header:'chapter',dataIndex:'col_chapter'},
            {
    header:'target',dataIndex:'col_target'}
        ]);
        
        var 
    targetGrid = new Ext.grid.EditorGridPanel({
            
    renderTo:'target_grid',
            
    cm:targetCm,
            
    store:targetStore,
            
    tbar: [{
                
    text'add',
                
    handler: function(){
                    var 
    = new targetRecord({
                        
    col_id:3,
                        
    col_book'a',
                        
    col_chapter'a',
                        
    col_target'a'
                    
    });
                    
    targetGrid.stopEditing();
                    
    targetStore.insert(0,e);
                    
    targetGrid.startEditing(0,0);
                }
            }]
        });
        


  2. #2

    Default

    i've put it right.. http://www.sencha.com/forum/showthre...splays-in-Grid
    it really tortured me all the day...

    the answer is. height.

  3. #3
    Sencha User fay's Avatar
    Join Date
    Apr 2007
    Location
    Ireland
    Posts
    1,750

    Default

    It is actually inserting the record, it's just that you've not specified a height for the EditorGridPanel. For the purposes of your example, just add autoHeight: true to the grid's config:

    Code:
     
    // ...
    renderTo:'target_grid',
    autoHeight: true,
    // ...
    Please read the docs about renderTo and autoHeight when you come to expand your example to use within layouts/containers/etc.

Similar Threads

  1. Replies: 4
    Last Post: 17 May 2009, 7:26 AM
  2. Ext.grid.RowNumberer and grid.getStore().insert()
    By tobiu in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 28 Dec 2008, 5:50 AM
  3. Ext.data.Store after insert record, filter method does not work
    By thinplum2008 in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 26 Aug 2008, 5:38 AM
  4. Accordion "insert" does not work
    By kkbear in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 19 Feb 2008, 6:26 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •