Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Change Text Buttons in Ext.grid.plugin.RowEditing

  1. #1
    Sencha User
    Join Date
    May 2010
    Location
    Bogota
    Posts
    27

    Default Change Text Buttons in Ext.grid.plugin.RowEditing

    Hi again,

    I'm using the RowEditing plugin in a GridPanel, but I can't find the config option for changing the text buttons. Only appears 'Update' and 'Cancel'. Sencha Docs doesn't offer further details...
    Is there any config option for this??

    Thanks.

  2. #2
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,102

    Default

    I would also like to know how to change the button texts. It appears that in previous Ext JS versions, this was possible using config parameters like saveText and cancelText but I havent found any way to do it in Ext JS 4.

  3. #3

    Default

    Farish,

    You can change button text using settext method either in a listener or somewhere else. I'm modifying it in a method. This is how I do it in my form

    changeText: function(){
    this.myButton.setText('<span class="selectedTab">New Text</span>');
    }

    You can add it to the listener as

    this.myButton= new Ext.Button({
    text: '<span class="activeTab">Old Text</span>',
    id: 'myButton',
    scope: this,
    listeners: {
    click: {
    fn: function () {
    this.setText('New Text');
    }

    }
    },
    cls: 'button',
    autoRender: true
    });

  4. #4
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,102

    Default

    thanks for your reply. but how do i get hold of the button. its not a button i create so i dont know the id or anything....

  5. #5

    Default

    Is this inside a grid? I've not worked on retrieving grid item with sencha yet, but I guess there should be a way to get the grid item and then change the text.

  6. #6
    Sencha User
    Join Date
    Sep 2010
    Posts
    1

    Default

    Quote Originally Posted by lord_of_php View Post
    Hi again,

    I'm using the RowEditing plugin in a GridPanel, but I can't find the config option for changing the text buttons. Only appears 'Update' and 'Cancel'. Sencha Docs doesn't offer further details...
    Is there any config option for this??

    Thanks.
    If you want it to be global you can do this:
    Code:
    Ext.grid.RowEditor.prototype.cancelBtnText = "My cancel button text";
    Ext.grid.RowEditor.prototype.saveBtnText = "My update button text";
    Ext.grid.RowEditor = new Ext.grid.RowEditor();

  7. #7
    Sencha User
    Join Date
    May 2010
    Location
    Bogota
    Posts
    27

    Default

    Thanks rvntone, it works!!

    This code is useful in "ext-lang-[locale].js"

  8. #8
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,501

    Default

    FWIW, this is part of my "ext-ux-lang-es.js" file:

    Code:
    Ext.onReady(function() {
    	// No ux pero no est en ext-lang-es.js
    	if (Ext.grid.RowEditor) {
    		Ext.apply(Ext.grid.RowEditor.prototype, {
    			saveBtnText : "Guardar",
    			cancelBtnText : "Cancelar",
    			errorsText : "Errores",
    			dirtyText : "Debe guardar o cancelar sus cambios"
    		});
    	}

  9. #9
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,102

    Default

    thanks rvntone!

  10. #10
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,102

    Default

    how can I change the text of the buttons after the creation of the rowediting plugin? e.g. I would like to have "Add" when a user adds a new record and "Update" when the user clicks an existing record to edit it.

Page 1 of 2 12 LastLast

Posting Permissions

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