-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New listview option icon - change or disable icons on listviews #4582
Conversation
Related feature request: #4570 |
hi @MauriceG I think the default for listview option icon should be If we make it an option for listview we have to offer the possibility to set it with a data-attribute on the listview, not only programmatically. That's not in your code, right? The value for the option icon for the call to buttonMarkup is now a very long line with OR statements. I suggest to create a variable. That variable should be a function that checks if data-icon is set on the listview item. If not it should fall back to the data-icon attribute of the parent listview. If that has not been set as well it falls back to the option which is "arrow-r" by default but can be configured programmatically. BTW - When we make this change we should not forget to update the listview options page in the docs and the data-attribute reference. |
Hi @uGoMobi May I missed something, but you can:
I've tried to make the change as tiny as possible and I think the icon condition is still easy to read and there is no need for another function. If this will get in, I hopefully will not forget the docs ;-) Maurice |
hi @MauriceG You are right, it does work! Most probably I am the one who missed something here. Below you'll see the code that I had in mind. This is basically the same thing written in another way, but with one difference. That is To be honest, I still don't understand how this works in your code. I only see
|
Hi @uGoMobi Maurice |
…on name from icon to listIcon
If I look at http://test.jqmobile.de/js/widgets/listviewSetIcon.js which is loaded by your test page, I see your code how it was after the first commit. It doesn't include the changes of the second commit. Am I right? I had a look at When I test your code (after the second commit) I see it works, except for one thing. The We shouldn't use new option names if not necessary, because that is not user friendly. So |
Hi @uGoMobi With the first commit everything works fine. Also the But I let inspire myself by your notes and code examples to
After the second commit still everything works except setting the list item Maurice |
hi @MauriceG The good news is that if you just change "listIcon" to "icon" everything will be fine again :) Jasper |
Hi @uGoMobi What a fight :-) Maurice |
@uGoMobi |
hi @MauriceG Why did you close? We are not done yet ;-) I meant adding a 3rd commit so that would mean changing version 2. You are right though, Your version one works fine. It was just that at the beginning it wasn't clear to me how, but now it is. It's true though that I am not in favor of having an option defined by a short-hand if statement with multiple or statements wrapped inside it. I suggest we ask @johnbender or @gseguin what they think of landing your first commit. Jasper |
Instead of change or disable icons on every list item, this option enables it per listview.
The default icon
arrow-r
can be changed or disabled at all.The ability to change or enable icon for individual item still remains.
Demo at: http://jsfiddle.net/MauriceG/swtKy/
Fullscreen: http://jsfiddle.net/MauriceG/swtKy/show/light/