jQuery UI Widgets › Forums › Navigation › Menu, Context Menu › How do I add a separator when loading from an array?
Tagged: HTML5 Data, jQuery Menu, jqxMenu, Menu, Non-standard Attributes, Separator
This topic contains 9 replies, has 5 voices, and was last updated by ci 10 years ago.
-
Author
-
It’s possible to have a separator when building the list from HTML: type=”separator”.
How do I do this when building the list from an array?
Hi ghenne,
There’s currently no such option. I will create a work item about this missing functionality and we’ll implement it for a future version. Thank you for the great suggestion.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comThank you!
Hello !
While you’re at that, please note that LI tag doesn’t have a “type” attribute in the HTML5 standard, and I’m trying to create a w3c standards “perfect” website.
How about replacing {LI type=”separator”} with: {LI data-type=”separator”} , very easy change!
—-
In a related aspect, there is another thing related to menus:{LI ignoretheme=’true’} Another non-standard attribute, change that as well to : {LI data-ignoretheme=’true’}
(For compatibility, it should recognize the original attribute as well, at least until version 3.0)
—-
Actually, can you please replace ANY non-standard html attributes with data-something equivalents ?
They are obviously very easy to access from jquery: $(selector).data(“something”)http://ejohn.org/blog/html-5-data-attributes/
Thank you for making such a great product !
Hi wavetrex,
We will consider your suggestions for the future versions. However, as we already use these attributes since version 1.0 and our customers already use them in their projects, we will probably keep them at least for an year, because we do not wish to make any breaking changes in the widget.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comI understand, I’ll rephrase my request:
Please ADD the ability in the system to recognize either the attribute $().attr(…) or a data-attribute $().data(…) , it’s a minor change which I could probably do myself quickly if I had the source code. Well, still testing/learning your system, maybe in the near future I’ll get a Developer License… however at this point 400$ is a lot, but since my customer seems to like the new interfaces, you might have two new licensed users of jqx soon 🙂
It is important for me to have perfect HTML5 validation! (And I’m probably not the only one)
Thank you !
Hi wavetrex,
$().attr(…) is related to the HTML Element and it is not related to the widget and its behavior. If you wish you can add/remove attributes by using the jQuery’s API.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comBumping this topic – are we any closer to having the functionality to add separators when building the list from an array?
My dev team has had to locally fork the jQWidgets code in order to make this possible, unfortunately. Not an ideal situation.
Hi,
The feature for adding a separator when building the Menu from Array is not in our Roadmap. We will consider it in the future.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comI did so
<!DOCTYPE html>
<html lang=”en”>
<head>
<link rel=”stylesheet” href=”../../jqwidgets/styles/jqx.base.css” type=”text/css” />
<script type=”text/javascript” src=”../../scripts/jquery-1.10.2.min.js”></script>
<script type=”text/javascript” src=”../../scripts/demos.js”></script>
<script type=”text/javascript” src=”../../jqwidgets/jqxcore.js”></script><script type=”text/javascript” src=”../../jqwidgets/jqxmenu.js”></script>
<script type=”text/javascript”>
$(document).ready(function () {
var source = [
{ label: “item1” },
{ id: “menuSeparator” },
{ label: “item2” },
{ id: “menuSeparator” },
{ label: “item3” }
];
$(“#jqxMenu”).jqxMenu({ source: source, width: ‘180px’, height: ‘180px’, mode: ‘vertical’});
$(“li[id=’menuSeparator’]”).attr(“class”,”jqx-menu-item-separator jqx-rc-all”);
});
</script>
</head>
<body >
<div id=’jqxMenu’ style=’float: left;’></div>
</body>
</html> -
AuthorPosts
You must be logged in to reply to this topic.