am looking for how to set selected index for menu in W2UI
Problem:
have a menu named "selectMenu" and contains subitems(item1,item2,item3)if i click on any item then menu name should be changed to selected item name
how can i do this please give me solution of this
thank you
<!DOCTYPE html>
<html>
<head>
<title>W2UI Demo: grid-1</title>
<link rel="stylesheet" type="text/css" href="http://w2ui.com/src/w2ui-1.4.2.min.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script type="text/javascript" src="http://w2ui.com/src/w2ui-1.4.2.min.js"></script>
</head>
<body>
<div id="grid" style="width: 100%; height: 350px;"></div>
<script type="text/javascript">
$(function () {
$('#grid').w2grid({
name: 'TestGrid',
header: 'Test',
multiSelect: true,
show: {
toolbar: true,
header: true,
footer: true,
lineNumbers: false,
selectColumn: false,
toolbarDelete: false,
toolbarReload: false,
toolbarSearch: false,
toolbarColumns: false
},
toolbar: {
items: [
{ type: 'menu', id: 'selectMenu', caption: 'selectMenu',items: [{ text: 'Item 1'},{ text: 'Item 2'},{ text: 'Item 3' }]}
],
onClick: function (target, eventData) {
if (eventData.subItem) {
if (eventData.target.substr(0, eventData.target.indexOf(":")) == 'selectMenu') {
alert('selectMenu' + ' ' + eventData.subItem.id + ' ' + eventData.subItem.text + ' ' + eventData.target.substr(0, eventData.target.indexOf(":")));
}
else if (eventData.target.substr(0, eventData.target.indexOf(":")) == 'allNetworks') {
alert('hi' + ' ' + eventData.subItem.id + ' ' + eventData.subItem.text + ' ' + eventData.target.substr(0, eventData.target.indexOf(":")));
}
}
}
}
});
});
</script>
</body>
</html>