Results 1 to 3 of 3

Thread: How to pass parameter/model between xmlStore?

  1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    3

    Default How to pass parameter/model between xmlStore?

    I got two xmlStore.
    1. The first store(A) contain two model:
    -BusID
    -BusName

    2. The second store( contain two model as well:
    -routeID
    -routeName

    My question: How to pass BusID to routeID? Because i need to get busID as a url parameter.
    If busID =1,,routeID will equals to 1 as well and display the data.

    How to achieve this? Thanks much

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379
    Answers
    3997

    Default

    Sounds like you want to use associations really. Without it all you have to do is resolve the other store and get the param you need
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    3

    Default Associated

    These are my code:

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


    uses: [
    'MyApp.model.GetBusStop'
    ],


    config: {
    fields: [
    {
    name: 'BusRouteID'
    },
    {
    name: 'BusRouteName'
    }
    ],
    hasMany: {
    foreignStore: 'GetBusStop',
    model: 'MyApp.model.GetBusStop',
    primaryKey: 'BusStopID',
    foreignKey: 'BusRouteID'
    }
    }
    });

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


    uses: [
    'MyApp.model.GetBusRoute'
    ],


    config: {
    fields: [
    {
    name: 'BusStopRouteID'
    },
    {
    name: 'BusStopID'
    },
    {
    name: 'BusStopName'
    }
    ],
    belongsTo: {
    foreignStore: 'GetBusRouteStore',
    associationKey: 'BusRouteID',
    model: 'MyApp.model.GetBusRoute',
    primaryKey: 'BusStopID',
    foreignKey: 'BusRouteID'
    }
    }
    });

    How to link up both of them and retrieve the value BusRouteID... Thank you so much!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •