mercredi 18 juin 2014

Accessing bound data via a data view based on a formula?

So I have a simple bind/store setup in my Viewmodel, that has a formula tied to it.

Basically the store is tied to a grid, and I have a formula called currentOrder that is setup like so:



Code:



formulas: {
currentOrder: {
bind: {
bindTo:'{orderGrid.selection}',
deep: true
}
}

Now inside my panel I can setup basic things like setting the title of the panel like so:

Code:



bind: {
title: 'Order ID: {currentOrder.order_id}'
}

And the result is as you would expect, the title of the panel changes based on what item I have selected in the grid. I can essentially reference this currentOrder formula from anywhere within the panel. Including textfields, labels, titles, etc.

My issue arises when I'm trying to use a dataview (XTemplate). I can't get the view to work without requiring a "store" config variable but the issue is I want to reference my formula not the root store. So I can't do:


That doesn't work .. I want to access all of the selected data in the grid, so I want to make references to {currentOrder.order_id} and {currentOrder.name} etc .. but I can't for the life of me figure out how to access those items in the tpl.

If I try to do this:



Code:



bind: {
itemTpl: [ 'Some data {currentOrder.name}']
}

ExtJS chokes because it doesn't see the TPL at the root level of the dataview component. It's ignoring the fact that it's in a bind config value.

If I try to access the currentOrder data with the TPL at the root level, it doesn't find it.


So my question is .. is it possible to access this formula based data within the TPL? If so, how do I need to configure the "store" config variable to access it?





Aucun commentaire:

Enregistrer un commentaire