1. #1
    Sencha User
    Join Date
    Feb 2012
    Location
    Paris
    Posts
    111
    Answers
    2
    Vote Rating
    1
    Tchinkatchuk is on a distinguished road

      0  

    Default Unanswered: [ HOW-TO ] Extend getXXX Model/storefor grid, form, ...

    Unanswered: [ HOW-TO ] Extend getXXX Model/storefor grid, form, ...


    Hi all,

    I'll explain my will and hope someone could perhaps help me finding the best way to do it.
    I have store with i18n datas.
    My API return this :
    Code:
    {
       name: 'monvelo',
       name_default: 'mybike',
       description: null,
       description_default: 'lorem ipsum',
       slug: 'mybi',
       cost: 12,
       ...
    },{...}, ...
    I would like to display the xxx_default value when xxx is empty.
    But I want to create real good code so that it would be automatic for each new store/model.
    In facts, I would to find the best method(s) to extend so that grid, forms, ... get the right value.

    I thought about extending store.load, model.getData, model.getFields but for example, I miss the values while loading a grid with a store
    ...

    Thanks in advance for any tips.

    Sylvain

  2. #2
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,357
    Answers
    432
    Vote Rating
    200
    slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of

      0  

    Default


    I'm not quite sure what you're looking to do based on your description, but you mentioned setting a default value. Perhaps this is what you're looking for?
    http://docs.sencha.com/extjs/4.2.1/#...g-defaultValue
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our recruiting manager: sheryl@sencha.com

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Location
    Paris
    Posts
    111
    Answers
    2
    Vote Rating
    1
    Tchinkatchuk is on a distinguished road

      0  

    Default


    Thank you but it is not the field default value that I want to extend but the record value.
    In the record, if the field xx is empty and the field xxx_default is not, take the xx_default.

    This is simple but the place where I should extend in order to work in forms, grid ... is not at all.

  4. #4
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,357
    Answers
    432
    Vote Rating
    200
    slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of

      0  

    Default


    If field A needs to evaluate field B in a record to determine what value field A will have you might use the field's convert method to evaluate the record before setting the value:
    http://docs.sencha.com/extjs/4.2.1/#...ld-cfg-convert
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our recruiting manager: sheryl@sencha.com

Thread Participants: 1

Tags for this Thread