added activate plant functionality, improved datamapping, removed test button
[L-seed.git] / web / php / page / myplants.pg
index e3ee84f..d2f308f 100644 (file)
                                }
                        }
                },{
-                       id: 'plantlistTestPlant'
-                       ,text: 'Test'
-                       ,icon: 'img/icons/magnifier.png'
+                       id: 'plantlistCheckPlantSyntax'
+                       ,text: 'Check Syntax'
+                       ,icon: 'img/icons/accept.png'
                        ,cls: 'x-btn-text-icon'
                        ,disabled: true
-                       ,handler: editor.Test.createDelegate(editor, ['plantlistgrid'], true)
+                       ,handler: editor.CheckSyntax.createDelegate(editor, ['plantlistgrid'], true)
+               },{
+                       id: 'plantlistActivatePlant'
+                       ,text: 'Activate'
+                       ,icon: 'img/icons/accept.png'
+                       ,cls: 'x-btn-text-icon'
+                       ,disabled: true
+                       ,handler: function(){
+                               Ext.getCmp("plantlistgridEditor").stopEditing();
+                               var grid = Ext.getCmp("plantlistgrid");
+                               var selected = grid.getSelectionModel().getSelections();
+                               if(selected.length > 0) {
+                                   editor.Activate(selected[0]);
+                               }
+                       }
                },{
                        id: 'plantlistRefresh'
                        ,text: 'Refresh'
                                ,width: 200
                                ,sortable: true
                                ,dataIndex: 'Name'
-                               ,editor: {
-                                       xtype: 'textfield'
-                                       ,allowBlank: false
-                               }
                        },{
                                id: 'Code'
                                ,header: 'Code'
                                        ,allowBlank: true
                                }
                        },{
-                               id: 'Active'
-                               ,header: 'Active'
+                               id: 'IsActive'
+                               ,header: 'IsActive'
                                ,width: 200
                                ,sortable: true
-                               ,dataIndex: 'Active'
-                               ,editor: {
-                                       xtype: 'checkbox'
-                               }
+                               ,dataIndex: 'IsActive'
                        }
                ]
                ,sm: new Ext.grid.RowSelectionModel({
                        ,listeners: {
                                rowselect: function() {
                                        Ext.getCmp("plantlistDeletePlant").enable();
-                                       Ext.getCmp("plantlistTestPlant").enable();
+                                       Ext.getCmp("plantlistCheckPlantSyntax").enable();
+                                       Ext.getCmp("plantlistActivatePlant").enable();
                                }
                                ,rowdeselect: function() {
                                        Ext.getCmp("plantlistDeletePlant").disable();
-                                       Ext.getCmp("plantlistTestPlant").disable();
+                                       Ext.getCmp("plantlistCheckPlantSyntax").disable();
+                                       Ext.getCmp("plantlistActivatePlant").disable();
+                                       Ext.getCmp("plantlistActivatePlant").disable();
                                }
                        }
                })
        ,listeners: {
                show: communication.GetPlantList.createDelegate(communication)
        }
-}
\ No newline at end of file
+}