We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

how to get the selected id for split button

hi ,
    I am using split button in my application.
    I have defined like 
<button id="spltbutton11">login</button>
                                    <ul id="Ul11">
                                        <li><a rel='nofollow' href="#">User</a></li>
                                        <li><a rel='nofollow' href="#">Guest</a></li>
                                        <li><a rel='nofollow' href="#">Admin</a></li>
    </ul>
$("#spltbutton11").ejSplitButton({
                size: "normal",
               contentType: "imageonly",
                targetId: "Ul11",
            });
I want to know how to get the  selected Id for menu item in side the split button.how can  i get that in clickevent?

6 Replies

JA John Arokyaraj V Syncfusion Team December 12, 2013 01:36 PM UTC

Hi Charan,

 

Thanks for using Syncfusion Products.

 

We can get the selected item of Popup item list in Split-Button Widget using “itemSelected” Event. Please follow the below given code snippet to achieve this.

 

[HTML]

 

<button id="splitbuttonnormal">Save</button>

<ul id="menu1">

  <li><span>Open...</span></li>

  <li><span>Save</span></li>

  <li><span>Delete</span></li>

</ul>

 

[SCRIPT]

 

$("#splitbuttonnormal").ejSplitButton({

   size: "large",

   roundedCorner: true,

   targetId: "menu1",

   itemSelected: "spltbtnitmSelected"

});

 

function spltbtnitmSelected(e) {

   alert(e.Events.menuText + " item has been selected.");

}

 

 

 

Please let us know if this helps.

 

Thanks/Regards,

John Arokyaraj.V



CH charan December 12, 2013 03:21 PM UTC

hi,
it is not worked out for me,that selected item function is not calling.


MG Michael G. Schneider December 13, 2013 08:05 AM UTC

The follwing line from the sample

   itemSelected: "spltbtnitmSelected"

should be changed to 

   itemSelected: spltbtnitmSelected

Michael


JA John Arokyaraj V Syncfusion Team December 13, 2013 09:45 AM UTC

Hi charan,

Sorry for the Inconvenience caused.

we are not able to reproduce the issue. Can you please check with the sample in the following location? If still you face the problem, please revert us by modifying the sample based on your application along with replication procedure. This would be helpful for us to serve you.

Sample : Split-Button Sample

Please let us know if you need any further assistance.

Thanks/Regards,

John Arokyaraj.V



CH charan December 13, 2013 10:55 AM UTC

hi,
It is working.I am able to get the selected Item text.I want to give some thing like 

<button id="splitbuttonnormal">Save</button>

<ul id="menu1">

  <li id="1"><span>Open...</span></li>

  <li id="2"><span>Save</span></li>

  <li id="3"><span>Delete</span></li>

</ul>

I want id of selected (li) item in the itemSelected event .how can I get that??



JA John Arokyaraj V Syncfusion Team December 17, 2013 10:57 AM UTC

Hi charan,

Sorry for the Inconvenience caused.

 We can get the selected items ID of Popup item list in Split-Button Widget using “itemSelected” Event. Please follow the below given code snippet to achieve this.

 

[HTML]

 <button id="splitbuttonnormal">Save</button>

<ul id="menu1">

<li id="1"><a rel='nofollow' href="#">User</a></li>

 

<li id="2"><a rel='nofollow' href="#">Guest</a></li>

<li id="3"><a rel='nofollow' href="#">Admin</a></li>

</ul>

 

[SCRIPT]

 

$("#splitbuttonnormal").ejSplitButton({

   size: "large",

   roundedCorner: true,

   targetId: "menu1",

   itemSelected: "spltbtnitmSelected"

});

 

function spltbtnitmSelected(args) {

   alert("Item" + args.Events.element.id + "  has been selected.");

}

  

Please let us know if this helps.

Thanks/Regards,

John Arokyaraj.V

 


Loader.
Live Chat Icon For mobile
Up arrow icon