1. #1
    Ext User
    Join Date
    Dec 2007
    Posts
    31
    Vote Rating
    0
    vertigoMX is on a distinguished road

      0  

    Default Column header Renaming-Editing

    Column header Renaming-Editing


    I've been looking in the forums for Column Header Renaming-Editing... The EditorGridPanel only lets me edit rows, but i'm only interested in changing column headers. Any ideas on how to do this?

    thanx again for this great tool + forum

  2. #2
    Sencha User genius551v's Avatar
    Join Date
    Mar 2007
    Posts
    287
    Vote Rating
    0
    genius551v is on a distinguished road

      0  

    Default


    Very good question, im interesting too....somebody please?

  3. #3
    Ext User
    Join Date
    Dec 2007
    Posts
    31
    Vote Rating
    0
    vertigoMX is on a distinguished road

      0  

    Question


    Ok guys,

    I have another idea to acomplish this. Maybe if I just add an option to the headers drop down menu, and include like a textbox or a link to capture a value from a messagebox, so I can rename column header. So, I guess my question now is how do I add an option to the header dropdown, just below columns menu option.

    what do u think?

  4. #4
    Sencha User genius551v's Avatar
    Join Date
    Mar 2007
    Posts
    287
    Vote Rating
    0
    genius551v is on a distinguished road

      0  

    Default


    Yeah, good idea!

  5. #5
    Ext User
    Join Date
    Dec 2007
    Posts
    110
    Vote Rating
    0
    tunaboo is on a distinguished road

      0  

    Default


    My page is js inside of JSP.. so I use JSP to spit out the column headers. This way depending on how my page is called, I can have different header names and sizes.

    No idea how to change names dynamically.. seems like most of the time a given grid would have the same header names over its lifetime. You can always destroy an old grid, and make a new one with the desired column names..

  6. #6
    Ext User
    Join Date
    Dec 2007
    Posts
    31
    Vote Rating
    0
    vertigoMX is on a distinguished road

      0  

    Talking


    I found a Workaround for this, check it out:

    If you go to ext-all-debug.js file, on line 29,939 you will find the header column menu configuration, so I added the "Rename Column" option, so I ended up with something like this:
    Code:
                this.hmenu.add(
                    {id:"asc", text: this.sortAscText, cls: "xg-hmenu-sort-asc"},
                    {id:"desc", text: this.sortDescText, cls: "xg-hmenu-sort-desc"},
                    {id:"rename", text: 'Rename Column', cls: "xg-hmenu-rename"}
                );
    then, go to the handleHdMenuClick Handle on Line 30,618 and modify it to:
    Code:
            handleHdMenuClick : function(item){
            var index = this.hdCtxIndex;
            var cm = this.cm, ds = this.ds;
            switch(item.id){
                case "asc":
                    ds.sort(cm.getDataIndex(index), "ASC");
                    break;
                case "desc":
                    ds.sort(cm.getDataIndex(index), "DESC");
                    break;
                case "rename":
                    renameColumn(index, cm.getDataIndex(index));  //renameColumn(B,A.getDataIndex(B)) in minified version
                    break;
    And in my aspx page, I added the Javascript function that actually does the whole renaming thing.

    Code:
    function renameColumn(columnIndex, columnName)
    {
          var newColumnName = "new column Name";      
         /*       
           call the service via AJAX that updates the column name in the database...
           now lets update it visually in the grid without refreshing the page...
        */
         var oGrid = Ext.getCmp('myGrid'); //This gets the grid's object
         var columnModel = oGrid.getColumnModel(); // its cm
         columnModel.setColumnHeader(columnIndex, newColumnName);
        
    }
    And thats basically what I did, Now I have On-The-Fly Column Renaming. BTW, working with the ext-all-debug file is slow, so I manually went into the minified file and changed with the text editor, it wasn't so hard to add a couple of lines, and I didn't need to re-minify everything.

    cheers

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar