Unanswered: Is there a better method for getting the name of a model from a record.
I found the property [record].modelName but it's no where in the documentation for sencha. I don't want to rely on something that might go away so I'm curious if there's a better way to get the model data is tied to.
Why would you do/need that for? Can you further explain your scenario?
I'm reusing the base structure of a listview added to a navigationview and changing the store or the listview. I'm leaving the disclose and tap listener the same.
I not realize it's probably better to create a whole new list view with a different listener for the tap but I was trying to throw something together quickly. It seemed like there should be a way to see the model a record is tied to, but it's probably better to have a 1-1 relationship for a record and a listview.
I think there is. When looking at a record, it has a STORES array and each store has a MODEL property. So that should be possible.
Originally Posted by metric152
But I agree with the last part of your sentence. I also prefer it 'the clean way'. Makes it a lot more easier to maintain the code...
A better solution
After having some distance from the issue and thinking about it again I found a better way to check for the model I'm looking for.
I created a property on the model called isContentType and set it to true. it only exists on the model I want.
I used record.get('isContentType') and if it comes back as true then I can act on it.
If it's undefined then I can continue on as normal. Now checking on the raw object
Tags for this Thread