EasyUI Forum
May 07, 2024, 02:28:28 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Button group help  (Read 9297 times)
agulas
Newbie
*
Posts: 2


View Profile
« on: June 28, 2013, 12:28:39 AM »

I'm new to javascript and easyui and I run into this little problem when using easyui to build some webpages.
I wanna use the  Button Group extended from linkbutton.
and the code is like this:

<a href="javascript:void(0)" class="easyui-linkbutton" data-options="toggle:true,group:'g1',plain:true" iconCls="icon-redo" onclick="someMethod()" id="g1left">toggle1</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" data-options="toggle:true,group:'g1',plain:true" iconCls="icon-undo" onclick="someMethod(2)" id="g1right">toggle2</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" data-options="toggle:true,group:'g2',plain:true" iconCls="icon-redo" onclick="someMethod(3)" id="g2left">toggle3</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" data-options="toggle:true,group:'g2',plain:true" iconCls="icon-undo" onclick="someMethod(4)" id="g2right">toggle4</a>



and what i wanna do is, when click different button, I can filter different data to the datagrid.
So my question is how do I get which button is selected in the two button groups?
I tried some js code and they didn't work.
« Last Edit: June 28, 2013, 12:30:28 AM by agulas » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: June 28, 2013, 07:10:44 AM »

Retrieve the 'selected' property to get what buttons is pressed.
Code:
$('a.easyui-linkbutton').each(function(){
var opts = $(this).linkbutton('options');
if (opts.selected){
console.log(opts.text + ' selected');
}
});
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!