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
    Sencha User
    Join Date
    Apr 2011
    Location
    Lahore, Pakistan
    Posts
    5
    Vote Rating
    0
    appsgenii is on a distinguished road

      0  

    Default Unanswered: Sencha Touch belongsTo association using Store on Datalist

    Unanswered: Sencha Touch belongsTo association using Store on Datalist


    I want to get belongsTo record on datalist and show parent record fields.




    Ext.define('MyApp.model.Customer', {
    extend: 'Ext.data.Model',


    config: {
    fields: ['Id',
    'EMail'],
    hasMany: [{
    model: 'MyApp.model.OutstandingInvoice',
    name: 'OutstandingInvoice',
    primaryKey: 'Id',
    foreignKey: 'customerId',
    foreignStore: 'OutstandingInvoices'
    }]
    }
    });


    Ext.define('MyApp.model.OutstandingInvoice', {
    extend: 'Ext.data.Model',


    config: {
    fields: [
    'InvoiceDate',
    'InvoiceID',
    'customerId'
    ],
    belongsTo: [{
    model: 'MyApp.model.Customer',
    name: 'Customer',
    primaryKey: 'Id',
    foreignKey: 'customerId',
    foreignStore: 'Customers'
    }]
    }
    });




    Ext.define('MyApp.store.OutstandingInvoices', {
    extend: 'Ext.data.Store',


    config: {
    model: 'MyApp.model.OutstandingInvoice',
    storeId: 'OutstandingInvoiceStore',
    proxy: {
    useDefaultXhrHeader: false,
    type: 'ajax',
    url : 'http://localhost/getOutstandingInvoices',
    reader: {
    type: 'json'
    }
    },
    autoLoad: false
    }
    });




    Ext.define('MyApp.store.Customers', {
    extend: 'Ext.data.Store',


    config: {
    model: 'MyApp.model.Customer',
    storeId: 'CustomerStore',
    proxy: {
    useDefaultXhrHeader: false,
    type: 'ajax',
    url : 'http://localhost/getCustJList',
    reader: {
    type: 'json'
    }
    },
    autoLoad: false,
    sorters: [{
    property : 'FName',
    direction: 'ASC'
    }]
    }
    });






    Ext.define('MyApp.view.OutstandingInvoices', {
    extend: 'Ext.Panel',
    xtype: 'outstandingInvoicesXType',
    config: {
    cls : 'invoiceSummaryCls',
    scrollable: 'vertical',
    items: [
    {
    xtype: 'titlebar',
    docked: 'top',
    title: 'Outstanding Invoices'
    },
    {
    xtype : 'list',
    scrollable: false,
    store: 'OutstandingInvoiceStore',
    cls : 'p10',
    itemTpl: [
    '<div>Invoice # {InvoiceID}</div>',
    '<div>{InvoiceDate}</div>',
    '<div>{Customer.Email}</div>', // I want to show Customer name here as its belongsTo Customer
    ],
    listeners: {
    itemtap:function (list, index, targe, rec, e, eOpts) {
    console.log(rec)
    }
    }
    }
    ]
    }


    });




    I want to show Customer name in datalist but having issue with association or Xtemplate
    I am getting this error


    Uncaught Error: [ERROR][Ext.XTemplate#apply] Cannot read property 'Email' of undefined




    Please help me out in this.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,520
    Answers
    3447
    Vote Rating
    814
    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


    The store is using the customer model so you have the Id and EMail fields there. Then you can get the hasMany data from the Customer model.
    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.

  3. #3
    Sencha User
    Join Date
    Apr 2011
    Location
    Lahore, Pakistan
    Posts
    5
    Vote Rating
    0
    appsgenii is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    The store is using the customer model so you have the Id and EMail fields there. Then you can get the hasMany data from the Customer model.
    Can you please explain your answer, how can I use association in List?

Thread Participants: 1

Tags for this Thread