EasyUI Forum
March 28, 2024, 02:35:31 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: How to determine which tool in which panel has been clicked?  (Read 2758 times)
PaulMcGuinness
Newbie
*
Posts: 15


View Profile Email
« on: February 16, 2018, 02:38:20 AM »

I'm using Portal Layout to show widgets and want a single refresh tool on each panel (which I've done), but how can I tell which panel 'button' has been pressed.

I've modified the example for Portal layout below, but can't see anything in the event that indicates something I can reference.

Code:
function addPanels(portalState){
var columns = portalState.split(':');
for(var columnIndex=0; columnIndex<columns.length; columnIndex++){
var cc = columns[columnIndex].split(',');
for(var j=0; j<cc.length; j++){
var options = getPanelOptions(cc[j]);
if (options){
options.tools=[
{ id: j,
iconCls:'icon-refresh',
handler:function(e)
{
console.log(e);
console.log(this);
console.log($(this));
}
}
];

var p = $('<div/>').attr('id',options.id).appendTo('body');
p.panel(options);
$('#ucPortal').portal('add',{
panel:p,
columnIndex:columnIndex
});
}
}
}

}
Logged
PaulMcGuinness
Newbie
*
Posts: 15


View Profile Email
« Reply #1 on: February 16, 2018, 06:29:51 AM »

Ok - here is a solution that worked for me... I added a property "action" into my list of panels....


Code:
var p = $('<div/>').attr('id',options.id).appendTo('body');
p.panel(options);
if(options.action)
{
var tool = $('#' + options.id).panel('header').find('.panel-tool');
tool.prepend('<a href="javascript:' + options.action + '" class="icon-refresh"></a>');  // add an icon
}
$('#ucPortal').portal('add',{ panel:p, columnIndex:columnIndex });
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!