Hybrid View

  1. #1
    Ext User Stripeman's Avatar
    Join Date
    Apr 2008
    Location
    Heidelberg Germany
    Posts
    275
    Vote Rating
    0
    Stripeman is on a distinguished road

      0  

    Default How do I: Property Grid: define custom column names..

    How do I: Property Grid: define custom column names..


    I had thought that one could define a custom name for each column in a property grid. Not the name/value.. but in the grid itsself.

    IE:

    select lname, fname, bday from users were ID = 1;
    results -> put in store

    property grid has headers of Name / Value
    but each row is identifed as each column from the store. in this case its lname, fname and bday. i want the lname to be displayed as "Last Name" etc.

    In my post: http://extjs.com/forum/showthread.php?t=43390 (2nd one)
    I posted one of my custom columns as:

    PHP Code:
                    var comboBoxSecCakeField    = new Ext.form.ComboBox({
                                                                                 
    name:'SecCake'  
                                                                                
    ,hiddenId:'SecCake'
                                                                                
    ,hiddenName:'SecCake'
                                                                                
    ,storeSecCakeStore
                                                                                
    ,displayField'name'
                                                                                
    ,valueField'name'
                                                                                
    ,triggerAction:'all'  
                                                                                
    ,selectOnFocus:true 
                                                                                
    ,mode:'local'
                                                                                
    ,loadingText:'Loading...'
                                                                                
    ,typeAhead:true
                                                                                
    ,allowBlank:true
                                                                                
    ,emptyText:'Select SecCake...'  
                                                                                
    ,editable:true
                                                                           
    }); 
    But none of the custom column names is taking. Am i doing something wrong ? I need the ie to remain the same because it had to update the db with it. But i need the display name to be customizable.

    Thanks for any help

  2. #2
    Ext JS Premium Member saJoshua's Avatar
    Join Date
    Nov 2007
    Location
    South Africa
    Posts
    521
    Vote Rating
    5
    saJoshua is on a distinguished road

      0  

    Default


    Unfortunately the propertyGrid's column model does not allow for renaming of the columns. See this thread: http://extjs.com/forum/showthread.ph...718#post195718

    Another thread on the same nature. Not sure if it bears any fruit : http://extjs.com/forum/showthread.php?t=17489

    Joshua

  3. #3
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    You can rename the columns of a propertygrid by setting:

    Code:
    Ext.grid.PropertyColumnModel.prototype.nameText = 'Name';
    Ext.grid.PropertyColumnModel.prototype.valueText = 'Value';
    But if I understand correctly you don't want to change the column names, you want to change the property names.

    For that you can use the (undocumented) propertyNames config option, e.g.

    Code:
    var grid = new Ext.grid.PropertyGrid({
      ...
      propertyNames: {
        'lname': 'Last Name',
        'fname': 'First Name',
        'bday': 'Birthday'
      }
    });

  4. #4
    Ext User Stripeman's Avatar
    Join Date
    Apr 2008
    Location
    Heidelberg Germany
    Posts
    275
    Vote Rating
    0
    Stripeman is on a distinguished road

      0  

    Default


    Quote Originally Posted by Condor View Post
    You can rename the columns of a propertygrid by setting:

    Code:
    Ext.grid.PropertyColumnModel.prototype.nameText = 'Name';
    Ext.grid.PropertyColumnModel.prototype.valueText = 'Value';
    But if I understand correctly you don't want to change the column names, you want to change the property names.

    For that you can use the (undocumented) propertyNames config option, e.g.

    Code:
    var grid = new Ext.grid.PropertyGrid({
      ...
      propertyNames: {
        'lname': 'Last Name',
        'fname': 'First Name',
        'bday': 'Birthday'
      }
    });


    There is no way to put this in each form element?
    IE: new Ext.form.TextField({ allowBlank:false, propertyNames: 'Alternate Field Name' });

    yes you are right Condor.. I NEED the value and name to rename as it should be.. but just want a different name displayed.

    having lname or fname listed on the property grid is NOT user friendly as Seeing "First name" and "Last Name"!

    Terry

  5. #5
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    The property name/display name mapping (propertyNames) is completely separate from the property name/editor mapping (customEditors).

    So you can't specify the display name in the editor, but why would you need to?

  6. #6
    Ext User Stripeman's Avatar
    Join Date
    Apr 2008
    Location
    Heidelberg Germany
    Posts
    275
    Vote Rating
    0
    Stripeman is on a distinguished road

      0  

    Default


    Only to keep all the config in one place. I mean the way its setup right now i have an array for the new record, columnmodel, custom editors and now iwll have to have one for the names...

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