Home | Mail | Syndicate

welcome to my space

11 March, 2010 |

Problem submit a tbar inside a grid....

  • Hi,

    I have a GridPanel inside that i have created a tbar and added some buttons to it,i have given the "handler: submitForm" to go to new jsp file.

    My .js code
    =============================================
    /*
    * Ext JS Library 2.0
    * (c) 2006-2007, Ext JS, LLC.
    * licensing@extjs.com
    *
    * http://extjs.com/license
    */

    Ext.onReady(function(){
    Ext.QuickTips.init();

    var xg = Ext.grid;
    // shared reader
    var reader = new Ext.data.ArrayReader({}, [
    {name: 'Parent'},
    {name: 'Node'},
    {name: 'Current Fiscal Year'},
    {name: 'LastModified'},
    {name: 'Type'},
    {name: 'AnnualGoal(USD)'},
    {name: 'Q1 Goal(USD)'},
    {name: 'Q2 Goal(USD)'},
    {name: 'Q3 Goal(USD)'},
    {name: 'Q4 Goal(USD)'},
    {name: 'Ramp Rates'},
    {name: 'Notes'},
    {name: 'Validation Status'}
    ]);

    ////////////////////////////////////////////////////////////////////////////////////////
    // Grid 4
    ////////////////////////////////////////////////////////////////////////////////////////
    var sm = new xg.CheckboxSelectionModel();
    // var sm2 = new xg.CheckboxSelectionModel();
    var grid4 = new xg.GridPanel({
    id:'button-grid',
    store: new Ext.data.Store({
    reader: reader,
    data: xg.dummyData
    }),
    cm: new xg.ColumnModel([
    sm,
    {id:'Parent',header: "Parent", width: 200, sortable: true, dataIndex: 'Parent'},
    {header: "Node", width: 120, sortable: true, dataIndex:'Node'},
    {header: "Current Fiscal Year", width: 120, sortable: true, dataIndex:'Current Fiscal Year'},
    {header: "LastModified", width: 120, sortable: true, dataIndex: 'LastModified'},
    {header: "Type", width: 135, sortable: true, dataIndex: 'Type'},
    {header: "AnnualGoal(USD)", width: 120, sortable: true, dataIndex: 'AnnualGoal(USD)'},
    {header: "Q1 Goal(USD)", width: 120, sortable: true, dataIndex: 'Q1 Goal(USD)'},
    {header: "Q2 Goal(USD)", width: 135, sortable: true, dataIndex: 'Q2 Goal(USD)'},
    {header: "Q3 Goal(USD)", width: 120, sortable: true, dataIndex: 'Q3 Goal(USD)'},
    {header: "Q4 Goal(USD)", width: 120, sortable: true, dataIndex: 'Q4 Goal(USD)'},
    {header: "Ramp Rates", width: 135, sortable: true, dataIndex:'Ramp Rates'},
    {header: "Notes", width: 135, sortable: true, dataIndex: 'Notes'},
    {header: "Validation Status", width: 135, sortable: true, dataIndex: 'Validation Status'}
    ]),
    sm: sm,
    viewConfig: {
    forceFit:false
    },
    // inline buttons
    buttons: [{text:'Submit'}],
    buttonAlign:'right',


    onSubmit: Ext.emptyFn,
    submit: function() {
    alert("Inside submit function 1234");
    this.getForm().getEl().dom.action = 'PAR_Create_goals_stage_view_add.jsp';
    this.getForm().getEl().dom.method='POST';
    this.getForm().getEl().dom.submit();
    },
    // inline toolbars
    tbar:[{
    text:'Validate Selections',
    tooltip:'Add a new row',
    iconCls:'validate'
    }, '-',{
    text:'Add New Record',
    handler: submitForm,
    tooltip:'Add a new row',
    iconCls:'add'

    }, '-', {
    text:'Delete Selections',
    tooltip:'Blah blah blah blaht',
    iconCls:'remove'
    },'-',{
    text:'Export to XLS',
    tooltip:'Remove the selected item',
    iconCls:'export'
    },'-',{
    text:'Import to XLS',
    tooltip:'Remove the selected item',
    iconCls:'import'
    },'-',{
    text:' Save ',
    tooltip:'Remove the selected item',
    iconCls:'save'
    },'-',{
    text:'Save as new Stage',
    tooltip:'Remove the selected item',
    iconCls:'saveas '
    }, '-', {
    text:'Submit to Production',
    tooltip:'Blah blah blah blaht',
    iconCls:'submit'
    }],
    //cm :cm,
    width:990,
    height:300,
    frame:true,
    autoScroll:true,
    iconCls:'icon-grid',
    renderTo: 'grid'

    });
    function submitForm(){
    alert("Inside Submit form");
    grid4.submit();
    }

    });

    // Array data for the grids
    Ext.grid.dummyData = [
    ['3m Co','Test','Test1','Test2','Test3','Test4','Test5' ,'Test6','Test7','Test8','Test9','3m Co','3m Co'],
    ['3m Co','3m Co','3m Co','3m Co','3m Co','3m Co','3m Co','3m Co','3m Co','3m Co','3m Co','3m Co','3m Co']
    ];
    // add in some dummy descriptions
    for(var i = 0; i < Ext.grid.dummyData.length; i++){
    Ext.grid.dummyData[i].push('Test');
    }
    ================================================== ==
    Can somebody help me in this regard,

    Murali.S


  • Where is the form you want to submit?


  • See Editor Grid example


  • Please post your code in CODE tags so others can read it.


  • Hi Santosh,

    How to add GridPanel to FormPanel,if u have any code please forward it to me.

    My mail id : murali.s@trianz.com

    Thanks adn regards,
    Murali.S







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about Problem submit a tbar inside a grid.... , Please add it free.
    PNNL, SGI Think Big Danes Launch Europe's First 24-Hour Internet TV Station