Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ext.define('Application.components.nsiAttributeSuggestForm', {
- extend: 'Ext.grid.Panel',
- initComponent: function () {
- var component = this;
- var store = new Ext.data.DirectStore({
- api: {
- read: RPC_nsi.Attribute.getAttributes,
- create: RPC_nsi.Attribute.updateAttributes,
- update: RPC_nsi.Attribute.updateAttributes,
- destroy: RPC_nsi.Attribute.deleteAttributes},
- },
- listeners: {
- load: function() {
- if (component.addNew) {
- component.addNew = false;
- component.pressAddBtn()
- }
- }
- }
- });
- Ext.apply(this, {
- viewConfig: {
- forceFit: true
- },
- columns: [
- {header: '№ атрибута'},
- {header: 'Название'},
- {header: 'Тип',},
- {
- header: 'Входит в наименование',
- processEvent: this.processEventThenBeforeUnable(component)
- },
- {header: 'Ед.измерения'},
- {
- header: 'Словарь',
- xtype: 'checkcolumn',
- processEvent: this.processEventThenBeforeUnable(component)
- },
- ],
- listeners: {
- rowclick: component.rowSelect,
- beforeedit: function(e) {
- return this.isEditable(e.record);
- }
- }
- });
- Application.components.nsiAttributeSuggestForm.superclass.initComponent.call(this);
- },
- processEventThenBeforeUnable: function(name, e, grid, rowIndex, colIndex, obj) {
- if(component.isEditable(record)) {
- return false;
- }
- record.set(this.dataIndex, !record.data[this.dataIndex]);
- this.fireEvent(name, this, e, grid, rowIndex, colIndex);
- return false;
- },
- isEditable: function(row) {
- return (row.dirty || row.phantom);
- },
- pressAddBtn: function () {
- this.store.insert(0, newRec);
- this.startEditing(0,1);
- },
- rowSelect: function (grid, rowIndex) {
- }
- });
Add Comment
Please, Sign In to add comment