Guest User

Untitled

a guest
Nov 18th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. Ext.define('Application.components.nsiAttributeSuggestForm', {
  2. extend: 'Ext.grid.Panel',
  3.  
  4. initComponent: function () {
  5. var component = this;
  6. var store = new Ext.data.DirectStore({
  7. api: {
  8. read: RPC_nsi.Attribute.getAttributes,
  9. create: RPC_nsi.Attribute.updateAttributes,
  10. update: RPC_nsi.Attribute.updateAttributes,
  11. destroy: RPC_nsi.Attribute.deleteAttributes},
  12. },
  13. listeners: {
  14. load: function() {
  15. if (component.addNew) {
  16. component.addNew = false;
  17. component.pressAddBtn()
  18. }
  19. }
  20. }
  21. });
  22.  
  23. Ext.apply(this, {
  24. viewConfig: {
  25. forceFit: true
  26. },
  27. columns: [
  28. {header: '№ атрибута'},
  29. {header: 'Название'},
  30. {header: 'Тип',},
  31. {
  32. header: 'Входит в наименование',
  33. processEvent: this.processEventThenBeforeUnable(component)
  34. },
  35. {header: 'Ед.измерения'},
  36. {
  37. header: 'Словарь',
  38. xtype: 'checkcolumn',
  39. processEvent: this.processEventThenBeforeUnable(component)
  40. },
  41. ],
  42. listeners: {
  43. rowclick: component.rowSelect,
  44. beforeedit: function(e) {
  45. return this.isEditable(e.record);
  46. }
  47. }
  48. });
  49. Application.components.nsiAttributeSuggestForm.superclass.initComponent.call(this);
  50. },
  51.  
  52. processEventThenBeforeUnable: function(name, e, grid, rowIndex, colIndex, obj) {
  53. if(component.isEditable(record)) {
  54. return false;
  55. }
  56. record.set(this.dataIndex, !record.data[this.dataIndex]);
  57. this.fireEvent(name, this, e, grid, rowIndex, colIndex);
  58. return false;
  59. },
  60. isEditable: function(row) {
  61. return (row.dirty || row.phantom);
  62. },
  63. pressAddBtn: function () {
  64. this.store.insert(0, newRec);
  65. this.startEditing(0,1);
  66. },
  67.  
  68. rowSelect: function (grid, rowIndex) {
  69. }
  70. });
Add Comment
Please, Sign In to add comment