Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Ext User
    Join Date
    Jul 2010
    Posts
    7
    Vote Rating
    0
    vvt-cjay is on a distinguished road

      0  

    Question Creating store with existing record definition

    Creating store with existing record definition


    Hello all!
    I' using Ext with ASP.NET MVC and DirectStores. I have some entity objects passed from/to server, so i have Ext.data.Record defined in client js. This definition is similar to server entity class definition. How I should construct Ext.data.DirectStore to use this Ext.data.Record definition instead of passing 'fields' array? Is it possible? How?

    Thanks for answer.

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,496
    Vote Rating
    44
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Do not use these shortcut classes. They remove knowledge about how to actually create the necessary structure.

    That class just creates a JsonReader configured with an Ext.data.Record and configures an Ext.data.Store with it.

    Do that.

  3. #3
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,496
    Vote Rating
    44
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    I've asked them to remove these horrible little classes, but they seem to think that saving a few lines makes up for people havig knowledge hidden from them. I profoundly disagree.

  4. #4
    Ext User
    Join Date
    Jul 2010
    Posts
    7
    Vote Rating
    0
    vvt-cjay is on a distinguished road

      0  

    Default


    Solved!
    PHP Code:
    new Ext.data.DirectStore({
                
    /*...*/

                
    fieldsProject.Entities.MyRecord
            
    }); 
    No no no! It's not necessary to remove these shortcut classes because them makes me able to descripe record (entity type, in fact) once, then use it in different places (store definitions, record creations, grids) not everytime copying-and-pasting this damn 'fields' array.

  5. #5
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,496
    Vote Rating
    44
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Exactly my point. You don't know what's happening. You have had it hidden.

    These classes a NOT. NOT necessary. They have hidden from you what is happening. You don't know what is happening.

  6. #6
    Ext User
    Join Date
    Jul 2010
    Posts
    7
    Vote Rating
    0
    vvt-cjay is on a distinguished road

      0  

    Default


    Need I to know what is actually happening? I see that store uses specified record definition, i know that using this definition all necessary (de)serializers are constructed (JsonReader etc.), moreover, I know how it actually constructed (through reading Ext sources and step-by-step debugging), but for what? Actually I need efficient and clear JS clident-side architecture and comfortable workflow for developers.

  7. #7
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,496
    Vote Rating
    44
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Well, obviously you do. If you had been using

    Code:
    project.entities.Customer = Ext.data.Record.create([....]);
    
    var curomerReader = new Ext.data.JsonReader({
        idProperty: customerId,
        root: 'rows',
    }, project.entities.Customer);
    
    var cusomerStore = new Ext.data.Store({
        ...
        reader: customerReader,
        ...
    });
    You'd know what was going on.

    There's your Record quite obviously there, being used.

    And there's your Store using it.

    All available.

    This was hidden by these daft shortcut classes.

  8. #8
    Ext User
    Join Date
    Jul 2010
    Posts
    7
    Vote Rating
    0
    vvt-cjay is on a distinguished road

      0  

    Default


    Well. And I am using something like this
    PHP Code:
    Ext.ns('MyProject.MyNamespace');
    MyProject.MyNamespace.MyRecord Ext.data.Record.create([...]);
    MyProject.MyNamespace.MyStore Ext.extend(Ext.data.DirectStore, {
        
    constructor: function (cfg) {
            
    this.fields MyProject.MyNamespace.MyRecord;
            
    //this construction obviously points that
            //this store operates collection of MyRecord
        
    }
    }); 
    Moreover, I have C# server-side construction exactly the same
    PHP Code:
    namespace MyProject.MyNamespace {
        [
    DataContract]
        public class 
    MyRecord {
            public 
    Int64 Id {get;set;}
        }
        
        public class 
    MyRecordDAO {
            public static 
    Create(...) {...};
            public 
    IEnumerable<MyRecordRead(...) {...};
            public static 
    Update(...) {...};
            public static 
    Delete(...) {...};
        }

    As you could see, I'm not interested in which way Ext operates with JsonReader
    Of course, if I will change client-server protocol to.. hm.. may be some binary protocol, the best architectural way will be to inherit Ext.data.Store, in context of my store inherit Ext.data.DataReader and incapsulate data functionality in my store. I prefer this way because I usually operate store but not reader directly.

  9. #9
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    82
    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


    No, I think you are missing the point.

    Animal is against using classes like DirectStore, because they hide the actual used classes. He proposes to always use a Store (and you can create a DirectProxy and a JsonReader in your own Store descendant constructor).

  10. #10
    Ext User
    Join Date
    Jul 2010
    Posts
    7
    Vote Rating
    0
    vvt-cjay is on a distinguished road

      0  

    Default


    Oh. Thanks. I dismentioned Animal's words.
    In this case, I agree with he. All is OK except one thing...
    Ext.data.DirectStore is best way to operate ASP.NET MVC controllers. Of course, I can 'extend' Ext.data.Store, but for what? There is Ext.data.DirectStore which ensures required functionality. It will be useful to create my custom store for .NET WCF, but creating store similar to Ext.data.DirectStore in this case looks like inventing-a-wheel

Similar Threads

  1. Any way to extract field names from a record definition?
    By shiv in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 24 Sep 2008, 7:20 AM
  2. including data.record definition in pre-conf. class?
    By blancomario in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 18 Jun 2008, 6:30 AM
  3. Record definition
    By --maty in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 17 Apr 2008, 3:12 PM
  4. Create Record (type definition, not data) from MetaData?
    By jezmck in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 27 Mar 2008, 5:01 AM
  5. Initializing Store object with an existing Record
    By aendo in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 27 Nov 2007, 11:53 PM

Thread Participants: 2

Tags for this Thread