1. #21
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,668
    Answers
    3354
    Vote Rating
    746
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    I would think that is only going to allow you to use one record so don't rely on the data being correct.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  2. #22
    Sencha User
    Join Date
    Aug 2010
    Posts
    17
    Vote Rating
    1
    pyoungerv is on a distinguished road

      0  

    Default


    that sounds like a critical problem, but i dont understand what you are describing. please explain further. so far, i appear to be iteratively setting the .rec property to the current records right before executing the template pseudocode for that record, which seems to be working.

  3. #23
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,668
    Answers
    3354
    Vote Rating
    746
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    If you are using MVC then logic should be in the Controller or a Utility class, the model just has data and the Controller or Utility class would act on that data.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #24
    Sencha User
    Join Date
    Aug 2010
    Posts
    17
    Vote Rating
    1
    pyoungerv is on a distinguished road

      0  

    Default


    i see. i am using MVC and consider it a very useful design paradigm.

    i am still concerned by your statement
    so don't rely on the data being correct.
    would you mind clarifying how the data could be incorrect?

    regarding MVC, i think i have still maintained an MVC approach. Lists are already aware that Models exist and have dependency on the store and model classes, they are just agnostic to the Model design. both the List and Template provide a simple iteration facility and already pass data instances to overridable iterative methods.

    the one missing piece, as far as i can tell, is that the List supplies ONLY the data from the Model and not the Model itself to the template. is this to prevent potential memory leaks? as in, a template might hold on to a Model reference too long? do compiled templates get fully cleaned up along with any references? if you wouldnt mind sharing more about that, i would appreciate it. right now, memory leaks are my largest concern, aside from your statement about incorrect data.

    by they way, i am a big fan of sencha's design. especially 2.0. the better i understand it the more i love it.

  5. #25
    Sencha User
    Join Date
    May 2009
    Posts
    8
    Vote Rating
    0
    gjuggler is on a distinguished road

      0  

    Default


    I started using this solution, too. It's a shame that Ext doesn't support access to the record from within the template by default — I agree with pyoungerv that it would help code organization to be able to consolidate all useful instance methods within the Model definition.

  6. #26
    Sencha User
    Join Date
    May 2012
    Posts
    1
    Vote Rating
    0
    anthonyroldan is on a distinguished road

      0  

    Default


    Interesting solution.. I'm trying to find my way around the same problem now.

    I've been thinking about re-implementing templating for DataViews with an extension or override that would let you something like Handlebars templates with access to the model instance for the record instead of being forced to use the bizarre XTemplate implementation. I'll post in the thread again once I have something to show!

    For now, I'll stick methods in the template instance .

  7. #27
    Ext JS Premium Member
    Join Date
    Nov 2009
    Posts
    230
    Answers
    1
    Vote Rating
    1
    chinabuffet is on a distinguished road

      0  

    Default


    Has anyone found an updated way (hopefully supported directly in the framework) for doing this?

    I can see the argument of having the Controller or some kind of formatting utility class do this kind of work, but passing back the model's raw id and doing a store lookup on that again seems pretty obnoxious.

  8. #28
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,668
    Answers
    3354
    Vote Rating
    746
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Just had a thought, you could do this:

    Code:
    Ext.define('Foo', {
        extend : 'Ext.data.Model',
    
        fields : ['bar']
    });
    
    var record = new Foo({
        bar : 'baz'
    });
    
    new Ext.Component({
        renderTo : document.body,
        tpl      : '{[values.foo.get("bar")]}',
        data     : {
            foo : record
        }
    });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  9. #29
    Ext JS Premium Member
    Join Date
    Nov 2009
    Posts
    230
    Answers
    1
    Vote Rating
    1
    chinabuffet is on a distinguished road

      0  

    Default


    Is there a way to make that kind of thing work with a Store + List? What I'm doing for the time being is:

    Code:
    prepareData: function(data, index, record) {
        data.modelRef = record;
    
    
        return data;
    }
    which isn't terrible, but it would be really nice if the framework provided a built-in way for doing this. XTemplates still work the same way they do before Ext.data.Model and any built-in support for MVC existed, and it just seems like it's due for some updates.

  10. #30
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,668
    Answers
    3354
    Vote Rating
    746
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You can execute any arbitrary javascript between the {[ and ]} or you can use the member functions feature. XTemplate is meant to work with an object or array. If you want to use it with a store, you can use the Ext.dataview.DataView component.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

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