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.
Unfortunately, activation email could not send to your email. Please try again.

how to get the selected id for split button

Thread ID:

Created:

Updated:

Platform:

Replies:

114867 Dec 11,2013 09:15 AM Dec 17,2013 05:57 AM JavaScript 6
loading
Tags: General
charan
Asked On December 11, 2013 09:15 AM

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?

John Arokyaraj V [Syncfusion]
Replied On December 12, 2013 08:36 AM

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


charan
Replied On December 12, 2013 10:21 AM

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

Michael G. Schneider
Replied On December 13, 2013 03:05 AM

The follwing line from the sample

   itemSelected: "spltbtnitmSelected"

should be changed to 

   itemSelected: spltbtnitmSelected

Michael

John Arokyaraj V [Syncfusion]
Replied On December 13, 2013 04:45 AM

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


charan
Replied On December 13, 2013 05:55 AM

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??


John Arokyaraj V [Syncfusion]
Replied On December 17, 2013 05:57 AM

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.\n");

}

  

Please let us know if this helps.

Thanks/Regards,

John Arokyaraj.V

 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;