{"id":168413,"date":"2013-02-05T21:45:03","date_gmt":"2013-02-05T17:45:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=168413"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=168413","title":{"rendered":"<span class=\"post_title\">\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441\u0442\u0440\u043e\u043a Ext.grid.Panel \u0441 Ext.toolbar.Toolbar<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u043c\u043d\u0435 \u043f\u043e\u0441\u0447\u0430\u0441\u0442\u043b\u0438\u0432\u0438\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u0442\u0440\u043e\u0439\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0439 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u0433\u0430\u0442\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 ExtJS 4.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f: <a href=\"http:\/\/siterra.org\/examples\/rowtoolbar.html\">http:\/\/siterra.org\/examples\/rowtoolbar.html<\/a><br \/>  \u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439: <a href=\"https:\/\/github.com\/siterra\/RowToolbar\">https:\/\/github.com\/siterra\/RowToolbar<\/a><br \/>  \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u0441 ExtJS 4.1.1a.<\/p>\n<p>  <a name=\"habracut\"><\/a><br \/>  \u0420\u0435\u0448\u0438\u043b \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0435 \u043f\u043e\u0434 \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0435\u0439 Apache License 2.0. \u0422\u0435\u043c \u0431\u043e\u043b\u0435\u0435, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u043e\u043d \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043b\u0435\u0433\u043a\u0438\u043c, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u0435\u0441\u044c\u043c\u0430 \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438. <\/p>\n<p>  \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0440\u0435\u0448\u0430\u0435\u0442 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u0437\u0432\u0443\u0447\u0438\u0442 \u043a\u0430\u043a \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u043a\u043d\u043e\u043f\u043e\u043a \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0433\u0438\u0431\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<p>  \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u00abactioncolumn\u00bb. \u041e\u0434\u043d\u0430\u043a\u043e, \u0434\u043b\u044f \u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043d\u0435\u0442 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u043a \u043a\u043d\u043e\u043f\u043a\u0435. \u041d\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043a\u043d\u043e\u043f\u043e\u043a \u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043b\u043e\u043d\u043a\u0435, \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u0438\u0445 \u043d\u0430 \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438, \u0442.\u043a. \u0440\u0430\u0431\u043e\u0442\u043d\u0438\u043a\u0443, \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043b\u0438\u0448\u044c \u043f\u0440\u043e\u0447\u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0432\u0443\u044e \u044f\u0447\u0435\u0439\u043a\u0443, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0442\u044f\u043d\u0443\u0442\u044c\u0441\u044f \u043a \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u0435.<\/p>\n<pre><code class=\"javascript\">\/* Copyright 2013 Siterra Ltd. (www.siterra.org)  Licensed under the Apache License, Version 2.0 (the &quot;License&quot;); you may not use this file except in compliance with the License. You may obtain a copy of the License at      http:\/\/www.apache.org\/licenses\/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.  *\/  Ext.define('Ext.ux.grid.features.RowToolbar', {     extend: 'Ext.grid.feature.Feature',     alias: 'feature.rowtoolbar',          rowToolbarCls: 'app-grid-feature-rowtoolbar',          toolbar: {},          init: function() {         this.toolbar = Ext.applyIf(this.toolbar, {             xclass: 'Ext.toolbar.Toolbar',             padding: '0 16 0 0',             cls: 'grid-feature-rowtoolbar-instance',             baseCls: '',             baseId: Ext.id() + '-rowtoolbar',                          \/* @optional              * @param isDisabledForRecord (function)              * Function gives a record to check enable item or not for it              * inputs              * @param record              * @return boolean              *\/                          \/* @optional              * @param isVisibleForRecord (function)              * Function gives a record to check visibility of item              * inputs              * @param record              * @return boolean              *\/                          \/* @optional              * @param hiddenItemsSavePosition (boolean)              * With this flag is true and element is hidden, then it's width              * doesn't 0. Visibility doesn't influence on positioning othe items.              *\/                          listeners: {                 scope: this,                 afterrender: function(tbar) {                     Ext.each(tbar.items.items, function(item) {                         if (item.isDisabledForRecord) {                             var is_disabled = item.isDisabledForRecord(item, tbar.record);                             item.setDisabled(is_disabled);                         }                         if (item.isVisibleForRecord) {                             var is_visible = item.isVisibleForRecord(item, tbar.record);                             if (item.hiddenItemsSavePosition) {                                 item.getEl().dom.style.visibility = (is_visible ? 'visible' : 'hidden');                             } else {                                 item.setVisible(is_visible);                             }                         }                     }, this);                 }             }             \/* @variable renderedItems               * Keeps rendered components created with help of this toolbar config              *\/                 \/* each renderedItem has                  * @variable record                   * what links to it's own record in store                  * Keeps rendered components created with help of this toolbar config                  *\/         });     },          renderItems: function() {         this.toolbar.renderedItems = [];         var els = Ext.query('.'+ this.toolbar.baseId +'-wrap', this.grid.getEl().dom);         Ext.each(els, function(el) {             \/\/ clone toolbar config for each row             var tb_clone = Ext.clone(this.toolbar);             tb_clone.items = Ext.clone(this.items);                          \/\/ find record in store for current row             var row = Ext.get(el).up('.x-grid-row');             if (row) {                 tb_clone.record = this.grid.getView().getRecord(row);             }                          \/\/ create and render toolbar for current row             tb_clone = Ext.create(tb_clone);             el.innerHTML = '';             tb_clone.render(el);                          \/\/ remember an item             this.toolbar.renderedItems.push(tb_clone);         }, this);     },          getRowToolbar: function() {         var tpl =              '&lt;tr class=&quot;'+ this.rowToolbarCls +'&quot;&gt;'+                 '&lt;td class=&quot;'+ this.rowToolbarCls +'&quot; colspan=&quot;{[ this.embedColSpan() ]}&quot;&gt;'+                     '&lt;div class=&quot;'+ this.toolbar.baseId +'-wrap '+ this.rowToolbarCls +'-btn&quot;&gt;&lt;\/div&gt;'+                 '&lt;\/td&gt;'+             '&lt;\/tr&gt;';                  return tpl;     },      embedColSpan: function() {         return '{rowToolbarColspan}';     },          getAdditionalData: function(data, idx, record, orig) {         var colspan = this.view.headerCt.getColumnCount();         return {             rowToolbarCls: this.rowToolbarCls,             rowToolbarColspan: colspan         };     },          mutateMetaRowTpl: function(metaRowTpl) {         metaRowTpl.push(this.getRowToolbar());     },      getMetaRowTplFragments: function() {         \/\/ render toolbar after some time         Ext.defer(this.renderItems, 50, this);                  return {             embedFullWidth: this.embedFullWidth,             embedColSpan: this.embedColSpan         };     } });  <\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043a\u0430\u043a \u00abfeature\u00bb. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043f\u043e\u0441\u043b\u0435 \u0441\u0435\u0431\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u00abrowwrap\u00bb. \u042d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438.<\/p>\n<pre><code class=\"javascript\">features: [{     ftype: 'rowtoolbar',     items: [         ...     ] },{     ftype: 'rowwrap' }] <\/code><\/pre>\n<p>  \u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 \u043f\u043e\u043b\u0435 items \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u0440\u043e\u043a \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0418\u043d\u043e\u0433\u0434\u0430 \u0440\u043e\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0444\u043b\u0430\u0433\u0438 \u00abhidden\u00bb \u0438 \u00abdisabled\u00bb. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 RowToolbar \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438 isDisabledForRecord \u0438 isVisibleForRecord. \u041a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 2 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430: \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 RowToolbar, \u0438 Ext.data.Record (Ext.data.Model), \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0441 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0441\u0442\u0440\u043e\u043a\u0438, \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c \u043c\u0435\u043d\u044f\u0442\u044c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.    \t \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/168413\/\"> http:\/\/habrahabr.ru\/post\/168413\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u043c\u043d\u0435 \u043f\u043e\u0441\u0447\u0430\u0441\u0442\u043b\u0438\u0432\u0438\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u0442\u0440\u043e\u0439\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0439 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u0433\u0430\u0442\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 ExtJS 4.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f: <a href=\"http:\/\/siterra.org\/examples\/rowtoolbar.html\">http:\/\/siterra.org\/examples\/rowtoolbar.html<\/a><br \/>  \u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439: <a href=\"https:\/\/github.com\/siterra\/RowToolbar\">https:\/\/github.com\/siterra\/RowToolbar<\/a><br \/>  \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u0441 ExtJS 4.1.1a.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-168413","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/168413","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=168413"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/168413\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=168413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=168413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=168413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}