1. #1
    Sencha User
    Join Date
    Aug 2012
    Posts
    32
    Vote Rating
    0
    Santosh Dhumale is on a distinguished road

      0  

    Default Unanswered: display and value field in grid editor.

    Unanswered: display and value field in grid editor.


    I have a grid editor. And this grid editor has the two drop downs.
    Where each dropdown has thedisplay field and value field. Initially the drop down display the display field but when I select value from drop downs it displays the selected value field. I want to display the selected display field and I have to save display field into database.
    Please help to resolve this issue.

  2. #2
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Answers
    124
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default


    Hi,

    may you provide your code for better understanding the problem
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  3. #3
    Sencha User
    Join Date
    Aug 2012
    Posts
    32
    Vote Rating
    0
    Santosh Dhumale is on a distinguished road

      0  

    Default


    pipegroup = Ext.create('Ext.grid.Panel', {
    store: pipegroupdatastore,
    forceFit : true,
    // height : 300,
    columns: [
    {
    header: 'LOWER SIZE',
    width : 60,
    dataIndex: 'pipegrouplowersize',
    //flex: 1,
    editor: {

    xtype : 'combo',
    name : 'pmspipegrouplowersize',
    id : 'pmspipegrouplowersize',
    store : sizestore,
    dataIndex: 'valuefield',
    displayField: 'lowersize',
    valueField: 'valuefield',

    editable : false,
    allowBlank: false

    }
    },
    {
    header: 'UPPER SIZE',
    width : 60,
    dataIndex: 'pipegroupuppersize',
    //flex: 1,
    editor: {
    // defaults to textfield if no xtype is supplied
    xtype : 'combo',
    name: 'pmspipegroupuppersize',
    id : 'pmspipegroupuppersize',
    store : sizestore,
    dataIndex: 'valuefield',
    displayField: 'uppersize',
    valueField: 'valuefield',
    allowBlank: false,
    editable : false
    }
    },

    And sizestore
    The json store looks like:

    [{"valuefield":1,"lowersize":15,"uppersize":15},{"valuefield":2,"lowersize":20,"uppersize":20},{"valuefield":3,"lowersize":25,"uppersize":25}...........................]

  4. #4
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Answers
    124
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default


    Hi,

    you can use renderer to particular column, tyr to use following code:

    Code:
    {
      header: 'LOWER SIZE',
      width : 60,
      dataIndex: 'pipegrouplowersize',
     / /flex: 1,
     editor: {
    
       xtype : 'combo',
       id : 'pmspipegrouplowersize',
      store : sizestore,
      displayField: 'lowersize',
      valueField: 'valuefield',
      , hiddenName:'pipegrouplowersize'
      editable : false,
      allowBlank: false
     },
    renderer:function (value, metaData, record, rowIndex, colIndex, store) {        var editor = yourgrid.getColumnModel().getCellEditor(colIndex, rowIndex)
                , field = editor.field
                , fieldRecord = field.findRecord(field.valueField, value);
            if (fieldRecord) {
                record.data[field.hiddenName] = value;
                value = fieldRecord.get(field.displayField);
            }
            return value;
        }
    }
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  5. #5
    Sencha User
    Join Date
    Aug 2012
    Posts
    32
    Vote Rating
    0
    Santosh Dhumale is on a distinguished road

      0  

    Default


    Thank you for your quick reply.

    The code given by is givving error "Object doesnt support this property" for very first line of rendrer function.

    I some where found the link similar to this:


    http://www.learnsomethings.com/2010/...in-a-nutshell/

    Its working.

    But when I select the lowersize=15 actually it displaying 300 which is asccociated with 15 value field but the actual 15 value field is 0.

  6. #6
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Answers
    124
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default


    Hi,

    try this line at the first line of renderer


    var editor = yourgrid.getColumnModel().getCellEditor(colIndex, rowIndex);
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  7. #7
    Sencha User
    Join Date
    Aug 2012
    Posts
    32
    Vote Rating
    0
    Santosh Dhumale is on a distinguished road

      0  

    Default


    I tried like this.

    renderer:function(value)
    {
    var index = sizestore.find("valuefield",value);
    if(index!=-1)
    {
    var displayName = sizestore.getAt(index).get("lowersize");
    }
    return displayName;
    }

    but again it displying the assciated display name of that value. I am not saving value field in database. I have to save display field of record.

  8. #8
    Sencha User
    Join Date
    Dec 2011
    Posts
    20
    Answers
    1
    Vote Rating
    0
    narram123 is on a distinguished road

      0  

    Default


    Try removing the data index from the combo's configuration and try.


    I guess it should work then.

  9. #9
    Sencha User
    Join Date
    Aug 2012
    Posts
    32
    Vote Rating
    0
    Santosh Dhumale is on a distinguished road

      0  

    Default


    After removing data Index is not working.

  10. #10
    Sencha User
    Join Date
    Aug 2012
    Posts
    32
    Vote Rating
    0
    Santosh Dhumale is on a distinguished road

      0  

    Default


    Yes Its working now.

    Now I have different problem.

    I have an javascript array for some requirement.

    Now when is grid is loading or after loading the value of drop downs of that grid should be inserted
    in that array.


    I tried using rendrer but not getting values means i tried giving alert it giving null value and it gives alert twise.

    please help me.

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi