1. #1
    Sencha User
    Join Date
    Mar 2008
    Posts
    58
    Vote Rating
    0
    johnstontrav is on a distinguished road

      0  

    Question HELP: grid combo on blur set valueField

    HELP: grid combo on blur set valueField


    Hi,

    Using: Ext 3.2.1

    I have a grid combo editor that load remote JSON data. All works fine except after selection of combo is displays the id field.

    1. Combo loads fine
    --------------------------------------
    combo1.jpg


    2. Make selection
    --------------------------------------
    combo2.jpg


    3. onBlur the displayField is gone and replace with valueField
    --------------------------------------
    combo3.jpg

    Here is my code:

    PHP Code:
    var myCombo = new Ext.form.ComboBox({
        
    fieldLabel             'myComboBox'
        
    ,hiddenName        'combo_id'
        
    ,valueField           'id'
        
    ,displayField         'descr'
        
    ,forceSelection     true
        
    ,triggerAction       'all'
        
    ,mode                 'remote'
        
    ,store                 : new Ext.data.JsonStore({
            
    id                'id'
            
    ,root            'rows'
            
    ,fields          : [
                    {
    name:'id'type:'int'}
                    ,{
    name:'descr'type:'string'}
            ]
            ,
    url            'combo.php'
        
    }) 
    });    


    var 
    grid = new Ext.grid.EditorGridPanel({
                ...
                ,
    columns: [
                    ...
                    {
    header'Combo Name' ,editormyCombodataIndex'combo_descr'}
                    ...
                    ]
                    ..
    }); 
    What am I doing wrong?

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    89
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    You not only need a column editor, you also need a column renderer that displays the description for an id.

  3. #3
    Sencha User
    Join Date
    Mar 2008
    Posts
    58
    Vote Rating
    0
    johnstontrav is on a distinguished road

      0  

    Default like this?

    like this?


    Quote Originally Posted by Condor View Post
    You not only need a column editor, you also need a column renderer that displays the description for an id.
    Thanks for the hint Condor. I found this blog post that may be what im looking for (not at work atm, so can't test it), but is this what you mean? Do you of any other documentation/examples that explains this concept?


    http://www.fusioncube.net/index.php/...t-for-datagrid

    PHP Code:
    function CodeRenderer(val){
        var 
    matching ItemCodesStore.queryBy(
                          function(
    rec,id){
                             return 
    rec.item_id == val;
                          });
        return (
    matching.items[0]) ? matching.items[0].data.item_code '';
    };

    // Snippet from ColumnModel of DataGrid
    header'Code',
    dataIndex'existingCode',
    width70,
    rendererCodeRenderer,
    editor: new Ext.form.ComboBox({
       
    mode'local',
       
    displayField'item_code',
       
    valueField'item_id',
       
    storeItemCodesStore
    }) 

  4. #4
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    89
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    This solution is better, but just like your own example, only works on a mode:'local' combobox.

Similar Threads

  1. combobox set displayField valueField
    By sofway in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 30 Mar 2010, 9:41 PM
  2. Replies: 12
    Last Post: 16 Feb 2010, 12:51 AM
  3. Blur combo box at the end of onSelect function
    By pieter333 in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 27 Feb 2009, 10:29 AM
  4. [Ext 2.0] Combo and Blur
    By sfwalter in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 30 Sep 2007, 1:14 PM

Thread Participants: 1

Tags for this Thread