Implement dedicated delete action for nm header in mobile template

This commit is contained in:
Hadi Nategh 2016-09-16 15:38:40 +02:00
parent 87226bfbcb
commit d895d1aa5a

View File

@ -994,16 +994,30 @@
*/ */
nm_onselect_ctrl: function(_widget, _action, _sender) nm_onselect_ctrl: function(_widget, _action, _sender)
{ {
var sender = _sender? _sender[0]:null;
// Update action_header status (3dots) // Update action_header status (3dots)
_widget.header.action_header.toggle(typeof _widget.getSelection().ids != 'undefined' && _widget.getSelection().ids.length > 0); _widget.header.action_header.toggle(typeof _widget.getSelection().ids != 'undefined' && _widget.getSelection().ids.length > 0);
// Update selection counter in nm header // Update selection counter in nm header
if (_widget._type == 'nextmatch' && _widget.getSelection().ids.length > 0) if (_widget._type == 'nextmatch' && _widget.getSelection().ids.length > 0)
{ {
if (sender && sender.actionLinks)
{
var delete_action = null;
for (var i=0; i< sender.actionLinks.length;i++)
{
if (sender.actionLinks[i].actionId == 'delete') delete_action = sender.actionLinks[i];
}
if (delete_action)
{
_widget.header.select_counter _widget.header.select_counter
.show() .show()
.text(_widget.getSelection().ids.length); .text(_widget.getSelection().ids.length)
.click(function(){
if (delete_action) delete_action.actionObj.execute([sender]);
});
}
}
} }
else else
{ {