opitzconsulting / jquery-mobile-angular-adapter

jquery mobile angular adapter
MIT License
517 stars 114 forks source link

how to use a listview's autodividersSelector #210

Open ghost opened 11 years ago

ghost commented 11 years ago

Hi Tigro,

I'm making fast progress with your jQm + ng adapter, thanks so far!

Trying to implement a listview widget which should use it's own autodividersSelector (see http://api.jquerymobile.com/listview/) I am now stuck.

Logging stuff by overriding "jqmNgWidgetProvider" for "listview" as you described in "Integrating custom jquery mobile plugins with angular" works fine, but I haven't found a clean way to extend the listview widget with an anonymous function for "autodividersSelector".

My workaround at the moment is to override the default prototype in "jquery.mobile.js" ($.mobile.listview.prototype.options.autodividersSelector = function(elt) { ... }). This does it for me, but I am sure there is a better way and it would be great to have it explained and documented!

Thanks again

Günther

tbosch commented 11 years ago

Hi, actually, I haven't played with the auto divider feature yet. Could you publish your solution as a plunk or jsfiddle (for templates see the Readme.md)? This would help a lot!

Thanks, Tobias

ghost commented 11 years ago

Hi Tobias,

I haven't actually a real solution. What I did is a very dirty and direct change in "jquery.mobile.js" in order to use the first element's "title" attribute as divider. Here for you to see:

http://jsfiddle.net/QLWd2/1/

I would appreciate a way to inject a personalized "autodividerSelector"-function (the way it is meant to be used with jQuery and without manually changing stuff in jquery.mobile.js).

Thanks!

Günther