Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1. this.libraryListGrid = new Ext.grid.EditorGridPanel({
  2. clicksToEdit: 1,
  3. colModel: new Ext.grid.ColumnModel({
  4. columns: [
  5. {
  6. header: '',
  7. menuDisabled: true,
  8. width: 33,
  9. dataIndex: '',
  10. fixed: true,
  11. renderer: this.renderOrder
  12. },
  13. {
  14. menuDisabled: true,
  15. dataIndex: 'name',
  16. editable: !this.config.viewOnly,
  17. editor: new Ext.form.TextField({
  18. allowBlank: true,
  19. controllerThis: this,
  20. autoCreate: {tag: 'input', type: 'text', maxlength: '10'},
  21. listeners: {
  22. blur: function(item){
  23. var record = item.getValue();
  24. record = Ext.util.Format.htmlEncode(record);
  25. item.setValue(record);
  26. },
  27. render: function(cmp)
  28. {
  29. cmp.getEl().on('click',function(){
  30. this.dom.focus();
  31. });
  32. }
  33. }
  34. }),
  35. header: 'Library',
  36. id: 'name'
  37. },
  38. {
  39. header: '',
  40. menuDisabled: true,
  41. width: 35,
  42. dataIndex: '',
  43. fixed: true,
  44. renderer: this.renderActions
  45. }
  46. ]
  47. }),
  48. ds: this.libraryListDataStore,
  49. height: 200,
  50. width: 'auto',
  51. allowEdit: true,
  52. listeners: {
  53. rowclick: {
  54. fn: onRowClick,
  55. scope: this
  56. }
  57. },
  58. forceValidation: true,
  59. loadMask: true,
  60. renderTo: 'libraryListGrid',
  61. stripeRows: true,
  62. tbar: [{
  63. disabled: this.config.viewOnly,
  64. text: "Add ",
  65. icon: '/images/ext-gantt/add.png',
  66. handler : function(){
  67. // access the Record constructor through the grid's store
  68. var LibraryListSize = this.libraryListGrid.getStore().data.length;
  69. var Plant = this.libraryListGrid.getStore().recordType;
  70. var p = new Plant({
  71. });
  72. this.libraryListGrid.stopEditing();
  73. this.libraryListDataStore.insert(LibraryListSize, p);
  74. this.libraryListGrid.startEditing(LibraryListSize, 1);
  75. },
  76. scope: this
  77. }],
  78. view:this.view
  79.  
  80.  
  81. });
  82. },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement