PDA

View Full Version : Child view model access when using formula



zz9pa
24 Feb 2015, 5:45 AM
Hi,

I'm using viewmodels, and have a child control which inherits a viewmodel
I needed to add a

viewModel:{} ,

to my child control to get access to the parent.

I can use

me.getViewModel().get('blah')

and thats working fine if 'blah' is in the data section.


I have some forumla in the viewModel :

data : {
UID:123
},
formulas: {
currentUserId: function (get) // Alias for UID
{
return get('UID');
}
}


Now - In the child - I have access to vm.get("UID") - but vm.get("currentUserId") is returning null.

Am I missing something ?
Is this expected behaviour ?
Should I be able to get the formula from child views ?

joel.watson
28 Feb 2015, 2:41 PM
Hi--

Can you create a Fiddle (https://fiddle.sencha.com) demonstrating the issue?

Thanks
Joel