mwaylabs / The-M-Project

'The-M-Project' is a Mobile HTML5 Application Framework.
www.the-m-project.org
Other
746 stars 152 forks source link

List item events do not pass the jQuery Event Object to the target controller. #104

Closed bradgreens closed 11 years ago

bradgreens commented 11 years ago

Is there a reason for this? Am I doing it wrong?

My controller expects an id an event to be passed into it. However the setActiveListItem method intentionally ops out of passing the jQuery Event with the following code.

You can see the NO parameter will tell the call handler function to not pass the event. However, when I click on my list item I am taking the user to a new page and need the jQuery event to identify which Model I should reference as it relates to the listItem.

Is there a better way to know which Model relates to the item I clicked?

bradgreens commented 11 years ago

Ok, I notice that I do get the modelId in the target controller method. How do I query my model for the unique ID?

I tried App.Model.find({m_id: modelId}) and App.Model.find({id: modelId}) but it returns the whole Model Collection, not the unique Model...

bradgreens commented 11 years ago

Ok, after plenty of debugging I got it by using the following in the target controller.

goToTabList: function(elId, modelId) { var modelRef = App.Model.find({ key: modelId }) this.switchToPage('tabList'); }

bradgreens commented 11 years ago

There should be documentation for these things ;)

sebastianwerler commented 11 years ago

Hi Brad,

you're right: there should be more documentation for the model. We're working on it for TMP 2.0.

But great you worked it out by yourself. "find" with "key: ..." is what was needed.

If there are any more question, don't hesitate to ask further. The best way to do this, is to use our google group at:

http://group.the-m-project.org

Welcome onboard and enjoy coding!

bradgreens commented 11 years ago

Thanks! The library is working quite well so far - Great job. I'm sure I'll stop by the Google Group soon.