1. #1
    Sencha User
    Join Date
    Sep 2014
    Posts
    41
    Vote Rating
    -3
    Answers
    3
    shakerkk has a little shameless behaviour in the past

      0  

    Default Answered: Combo box inside the grid.

    Hello ,

    I have a problem related to remote combo box inside a grid , i don't know if its a stupid question buy i just want to ask:

    It is possible to receive in a combo box request the option like this :

    "editor": {
    "xtype": "customcombobox",
    "queryMode": "remote",
    "requestUrl": "resources/data/ComboTestData.json"
    },data for combobox:
    [
    {
    title:test
    value:test
    },
    {
    title:test1
    value:test1
    }
    ]

    This are the configuration for combobox:

    displayField: 'title',
    valueField: 'value',typeAhead: false,
    forceSelection: true,
    minChars: 0,
    triggerAction: 'query',

    And when i save the grid to take only value from combo box ,and not an object like {title: , value: }???

    Thanks

  2. I found a temporary solution , is to add listener on grid store and if a column value is object then change it to plain value.

    me.store.addListener("beforesync",me.beforeStoreSyncHandler, me);
    beforeStoreSyncHandler:function(store){
    var me = this;

    //take the columns that are updated from the store
    var updatedRecords = store.update[0].data;

    //check if the value of the column is an object
    for (var prop in updatedRecords) {
    if (Ext.isObject(updatedRecords[prop]) && !Ext.Object.isEmpty(updatedRecords[prop])) {
    //check if the object has the property title and value
    if ( updatedRecords[prop].hasOwnProperty('title') && updatedRecords[prop].hasOwnProperty('value') ) {
    //modify the value of the found record from object to value
    updatedRecords[prop] = updatedRecords[prop].value;
    }
    }
    }
    },Its ugly buy at least feed my needs

  3. #2
    Sencha User jdkhamba's Avatar
    Join Date
    Jul 2012
    Posts
    75
    Vote Rating
    7
    Answers
    13
    jdkhamba will become famous soon enough

      0  

    Default

    You can render any custom ExtJS component inside a grid. Take a look at this thread:

    https://www.sencha.com/forum/showthr...-Grid-renderer

    Another option is to use Skirtle's User extension to do the same :

    http://skirtlesden.com/ux/component-column

  4. #3
    Sencha User
    Join Date
    Sep 2014
    Posts
    41
    Vote Rating
    -3
    Answers
    3
    shakerkk has a little shameless behaviour in the past

      0  

    Default

    Yes , i know how to render a component in a grid the problem is when i save the grid i make somthing like (store.sync() ) than the data from the combox i sent something like :

    col13{ { title: 'test', value:'test'}, gridId: 9999 }

    what i really want its something like col13{ value: ''test" , gridId: 999}. So basically i want somehow to remove title when i sent data on grid save

    P.S short story on save action on grid to send only the value from the remote combobox and not the title I dont know if is possible

  5. #4
    Sencha User jdkhamba's Avatar
    Join Date
    Jul 2012
    Posts
    75
    Vote Rating
    7
    Answers
    13
    jdkhamba will become famous soon enough

      -1  

    Default

    You can simply ignore that value on the server side

  6. #5
    Sencha User
    Join Date
    Sep 2014
    Posts
    41
    Vote Rating
    -3
    Answers
    3
    shakerkk has a little shameless behaviour in the past

      0  

    Default

    Well this is not really an option , i tough that you can config your combo box like in a form , where you have something like a hiddenName that save`s your value and when you are submitting the form it takes only the value and not the entire object

  7. #6
    Sencha User jdkhamba's Avatar
    Join Date
    Jul 2012
    Posts
    75
    Vote Rating
    7
    Answers
    13
    jdkhamba will become famous soon enough

      0  

    Default

    Well you can configure the store that is bound to the combobox with only the fields that you need. That way when the store record is updated then only the properties that you need will be sent to the server.

  8. #7
    Sencha User
    Join Date
    Sep 2014
    Posts
    41
    Vote Rating
    -3
    Answers
    3
    shakerkk has a little shameless behaviour in the past

      -1  

    Default

    How can i do that ?

    So i thing that is nothing that can be done related to this ?

  9. #8
    Sencha User
    Join Date
    Sep 2014
    Posts
    41
    Vote Rating
    -3
    Answers
    3
    shakerkk has a little shameless behaviour in the past

      0  

    Default

    I found a temporary solution , is to add listener on grid store and if a column value is object then change it to plain value.

    me.store.addListener("beforesync",me.beforeStoreSyncHandler, me);
    beforeStoreSyncHandler:function(store){
    var me = this;

    //take the columns that are updated from the store
    var updatedRecords = store.update[0].data;

    //check if the value of the column is an object
    for (var prop in updatedRecords) {
    if (Ext.isObject(updatedRecords[prop]) && !Ext.Object.isEmpty(updatedRecords[prop])) {
    //check if the object has the property title and value
    if ( updatedRecords[prop].hasOwnProperty('title') && updatedRecords[prop].hasOwnProperty('value') ) {
    //modify the value of the found record from object to value
    updatedRecords[prop] = updatedRecords[prop].value;
    }
    }
    }
    },Its ugly buy at least feed my needs

Similar Threads

  1. Replies: 7
    Last Post: 21 Sep 2013, 3:17 AM
  2. Replies: 7
    Last Post: 8 Aug 2012, 10:50 AM
  3. Combo box inside the grid
    By neerajnandwana in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 30 Apr 2008, 6:51 AM

Thread Participants: 1

Tags for this Thread