[GELÖST] Liste des Backend-Moduls "Versandkosten" erweitern

Hallo liebe Shopware - Gemeinde,

ich würde gerne ein weiteres Feld in der Listenansicht von „Einstellungen“ -> „Versandkosten“ hinzufügen. Leider bringt es mir einen ExtJs-Fehler (TypeError: c[b/].setSortState is not a function).

Folgenden Code habe ich schon am Beispiel der ID.

Bootstrap.php:

 private function subscribeEvents(){ $this-\>subscribeEvent( 'Enlight\_Controller\_Action\_PostDispatch\_Backend\_Shipping', 'onBackendShippingPostDispatch' ); } public function onBackendShippingPostDispatch(Enlight\_Event\_EventArgs $args){ $controller = $args-\>getSubject(); $request = $controller-\>Request(); $response = $controller-\>Response(); $view = $controller-\>View(); $this-\>Application()-\>Snippets()-\>addConfigDir($this-\>Path() . 'Snippets/'); $view-\>addTemplateDir($this-\>Path() . 'Views/'); if ($args-\>getRequest()-\>getActionName() === 'load') { $view-\>extendsTemplate('backend/shipping/view/attributeshipping/main/list.js'); } } 

list.js:

 // File location: AttributeShipping/Views/backend/shipping/view/attributeshipping/main/list.js //{block name="backend/shipping/view/main/list" append} /\*{namespace name="backend/shipping/view/main/list"}\*/ Ext.define('Shopware.apps.Shipping.view.attributeshipping.main.List', { override: 'Shopware.apps.Shipping.view.main.List', initComponent: function() { var me = this; var columns = me.callOverridden(arguments); var columnIdField = { header: '{s name=shipping\_grid\_id}ID{/s}', dataIndex : 'dispatch.id', renderer: me.idColumn }; return Ext.Array.insert(columns, 0, [columnIdField]); }, idColumn : function (value, metaData, record) { return record.get('id'); } }); //{/block} 

Testweise habe ich das ID-Feld in die themes\Backend\ExtJs\backend\shipping\view\main\list.js eingefügt, und da funktioniert es. Ich finde bisher aber nicht den Fehler. Hat jemand eine Idee?

Beste Grüße

Sebastian

Aus meiner Wühlkiste: /\*\* \* Aquatuning Software Development - Miscellaneous - Backend \* \* @category Aquatuning \* @package Shopware\Plugins\AtsdMiscellaneous \* @copyright Copyright (c) 2013, Aquatuning GmbH \*/ // {namespace name="backend/atsd\_miscellaneous/shipping/app"} // {block name="backend/shipping/view/main/list" append} Ext.define( "Shopware.apps.Shipping.view.AtsdMiscellaneous.main.List", { // override override: "Shopware.apps.Shipping.view.main.List", // init override initComponent : function() { // get this var me = this; // call the parent me.callParent( arguments ); // get the columns var columns = Ext.clone( me.columns ); // remove last element delete columns[columns.length - 1]; // create title column var column\_title = Ext.create( 'Ext.grid.column.Column', { header:'Interner Titel', dataIndex: 'attribute.atsdMiscellaneousTitle', renderer: me.titleColumn, width:250 } ); // add the column columns.unshift( column\_title ); // create id column var column\_id = Ext.create( 'Ext.grid.column.Column', { header:'ID', dataIndex: 'id.name', renderer: me.idColumn, sortable: false, width:50 } ); // add the column columns.unshift( column\_id ); // overwrite the action column var column\_actions = { header: '', xtype : 'actioncolumn', width : 80, items : [/\* {if {acl\_is\_allowed privilege=delete}} \*/ { iconCls : 'sprite-minus-circle-frame', action : 'delete', cls : 'dispatchDelete', tooltip : 'Versandart löschen' }, /\* {/if} \*/ /\* {if {acl\_is\_allowed privilege=update}} \*/ { iconCls : 'sprite-pencil', cls : 'editButton', tooltip : 'Versandart editieren' }, /\* {/if} \*/ /\* {if {acl\_is\_allowed privilege=create}} \*/ { iconCls :'sprite-blue-document-copy', cls :'cloneButton', tooltip :'Versandart kopieren', style : 'width: 16px; height: 16px' } /\* {/if} \*/] }; // and add it columns.push( column\_actions ); // reconfigure the store me.reconfigure( me.store, columns); }, // internal title renderer titleColumn: function (value, metaData, record) { return "**" + record.get( "atsdMiscellaneousTitle" ) + "**"; }, // name renderer nameColumn : function (value, metaData, record) { return record.get( "name" ); }, // id renderer idColumn : function (value, metaData, record) { return record.get( "id" ); }, // add a search createToolbar: function() { // get this var me = this; // create default items var items = [/\*{if {acl\_is\_allowed privilege=delete}}\*/ { iconCls : 'sprite-plus-circle', text : 'Versandart hinzufügen', action : 'addShipping' }, /\* {/if} \*/ /\*{if {acl\_is\_allowed privilege=delete}}\*/ { iconCls : 'sprite-minus-circle', text : 'Versandart löschen', disabled : true, action : 'deleteShipping' }, /\* {/if} \*/ "-\>", { xtype:'textfield', name:'searchfield', cls:'searchfield', width: 150, emptyText:'Suche...', enableKeyEvents:true, checkChangeBuffer:500, listeners: { change: { fn: function(field, value) { // go to 1st page me.store.currentPage = 1; // trim the search value var search = Ext.String.trim( value ); // set the search parameter me.store.getProxy().extraParams.search = search; // and reload the store me.store.load(); } } } }]; // return the toolbar return Ext.create('Ext.toolbar.Toolbar', { dock:'top', ui: 'shopware-ui', items: items } ); } }); // {/block} Viele Grüße

1 „Gefällt mir“

Hallo Aquatuning GmbH, ich danke dir, ich hab die Zeilen gefunden, die mir fehlten. Beste Grüße Sebastian

Hi

 

Könntest du eventuell die Zeile die fehlte einmal posten? Ich habe ein ähnliches Problem und komme nicht weiter.

Danke