From 9d26131b62888fb096e10af61809698271c19ed9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0smail=20=C3=87AGDA=C5=9E?= Date: Wed, 29 Mar 2017 14:38:09 +0300 Subject: [PATCH] removed record-actiosn from jtable --- jquery.jtable.js | 142 ----------------------------------------------- 1 file changed, 142 deletions(-) diff --git a/jquery.jtable.js b/jquery.jtable.js index 4bb417e6..b07a50f3 100644 --- a/jquery.jtable.js +++ b/jquery.jtable.js @@ -5035,145 +5035,3 @@ THE SOFTWARE. })(jQuery); -/************************************************************************ -* RECORD-ACTIONS extension for jTable * -*************************************************************************/ -(function ($) { - - //Reference to base object members - var base = { - _initializeFields: $.hik.jtable.prototype._initializeFields, - _onRecordsLoaded: $.hik.jtable.prototype._onRecordsLoaded - }; - - //extension members - $.extend(true, $.hik.jtable.prototype, { - - /************************************************************************ - * OVERRIDED METHODS * - *************************************************************************/ - - - /* Overrides base method to create sorting array. - *************************************************************************/ - _initializeFields: function () { - base._initializeFields.apply(this, arguments); - - var self = this; - - self._extraFieldTypes.push({ - type:'record-actions', - creator: function(record, field){ - return self._createRecordActionsDropdown(record, field); - } - }); - }, - - /* Overrides base method to handle dropdown menu overflow. - *************************************************************************/ - _onRecordsLoaded: function () { - base._onRecordsLoaded.apply(this, arguments); - - var self = this; - self._$tableBody.find('div.dropdown').on('show.bs.dropdown', function (e) { - var $this = $(this); - - if (!$this.data('_tether')) { - var $dropdownButton = $this.find('.dropdown-toggle'); - var $dropdownMenu = $this.find('.dropdown-menu'); - - $dropdownMenu.css({ - 'display': 'block' - }); - - $this.data('_tether', new Tether({ - element: $dropdownMenu[0], - target: $dropdownButton[0], - attachment: 'top left', - targetAttachment: 'bottom left', - constraints: [{ - to: 'window', - attachment: 'together', - pin: true - }] - })); - } - - var $dropdownMenu = $($this.data('_tether').element); - $dropdownMenu.css({ - 'display': 'block' - }); - }).on('hidden.bs.dropdown', function (e) { - var $this = $(this); - var $dropdownMenu = $($this.data('_tether').element); - $dropdownMenu.css({ - 'display': 'none' - }); - }); - }, - - /************************************************************************ - * PRIVATE METHODS * - *************************************************************************/ - - /* Builds the dropdown actions button according to field definition - *************************************************************************/ - _createRecordActionsDropdown: function(record, field){ - var self = this; - var $dropdownContainer = $('
') - .addClass('btn-group') - .addClass('dropdown'); - - var $dropdownButton = $('') - .html(field.text) - .addClass('dropdown-toggle') - .attr('data-toggle','dropdown') - .attr('aria-haspopup','true') - .attr('aria-expanded','true'); - - if(field.cssClass){ - $dropdownButton.addClass(field.cssClass); - } - - var $dropdownItemsContainer = $('').addClass('dropdown-menu'); - for (var i = 0; i < field.items.length; i++) { - var fieldItem = field.items[i]; - - if(fieldItem.visibility && !fieldItem.visibility(record)){ - continue; - } - - var $dropdownItem = self._createDropdownItem(record, field.items[i]); - $dropdownItem.appendTo($dropdownItemsContainer); - } - - if($dropdownItemsContainer.find('li').length > 0){ - $dropdownItemsContainer.appendTo($dropdownContainer); - $dropdownButton.appendTo($dropdownContainer); - } - - return $dropdownContainer; - }, - - _createDropdownItem: function(record, item){ - var $li = $('
  • '); - var $a = $(''); - - if(item.text){ - $a.html(item.text); - } - - if(item.action){ - $a.click(function(){ - item.action(record, $li.closest('tr')); - }); - } - - $a.appendTo($li); - return $li; - } - - }); - -})(jQuery); -