[CLOSED] Editable GridPanel

  1. #1

    [CLOSED] Editable GridPanel

    Hi all

    I need to create a Grid which is Editable for users with the needed rights.
    My first idea was 'Add Column Editors from Code Behind' if the users owns the edit right's.

    I did it like that :

                For Each column As ColumnBase In gridOrderItem.ColumnModel.Columns
                    Select Case column.GetType().ToString()
                        Case "Ext.Net.Column"
                            column.Editor.Add(New TextField)
    
                        Case "Ext.Net.DateColumn"
                            column.Editor.Add(New DateField)
    
                        Case "Ext.Net.NumberColumn"
                            column.Editor.Add(New NumberField)
    
                        Case "Ext.Net.CheckColumn"
                            '    column.Editor.Add(TryCast(New CheckBoxField))
    
                    End Select
                Next
    That didn't work ?!

    Are there any examples and/or tip's around how to solve this problem ?

    Kind Regards
    Peter
    Last edited by Daniil; Mar 19, 2013 at 9:12 AM. Reason: [CLOSED]
  2. #2
    Hi Peter,

    Which moment do you know a user's rights and need to configure a GridPanel?
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi Peter,

    Which moment do you know a user's rights and need to configure a GridPanel?
    Hi Daniil

    I know both on Page Load...
    But the Problem seems to be different from that what I was thinking first !
    On of the Grid Column is a Component Column showing a ComboBox I wrote (Inherits the Ext.Net.ComboBox).

    Am I right, the Component Column doesn't provide the Editor Functionality ?

    Peter
  4. #4
    Quote Originally Posted by sisa View Post
    Am I right, the Component Column doesn't provide the Editor Functionality ?
    It provides if set up Editor="true" for a ComponentColumn.
  5. #5
    Quote Originally Posted by Daniil View Post
    It provides if set up Editor="true" for a ComponentColumn.

    That's what I'm looking for :-)

    Now I got a other question...
    I added a CommandColumn via Code Behind


            Public Shared Sub AddEditColumn(grid As TablePanel)
    
                'Edit Column
                Dim editColumn As New CommandColumn
                editColumn.ID = grid.ID & "colEdit"
                editColumn.Width = New Unit(120)
    
    
                Dim delCommand As New GridCommand
                delCommand.CommandName = "cmdDelete"
                delCommand.Icon = Icon.Delete
                editColumn.Commands.Add(delCommand)
    
                Dim editCommand As New GridCommand
                editCommand.CommandName = "cmdEdit"
                editCommand.Icon = Icon.Pencil
                editColumn.Commands.Add(editCommand)
    
    
                editColumn.Listeners.ClearListeners()
                editColumn.Listeners.Command.Handler = "handleItem(command,  record);"
    
                grid.ColumnModel.Columns.Insert(1, editColumn)
    
            End Sub
    The Page doesn't load any more :-( There is a JS Error on the Page .
    This is the generated Code :

                                ,columns:{
                                    items:[{
                                        id:"ContentMaster_ucDeclarationItemGrid_gridDeclarationItemcolEdit",width:120,xtype:"commandcolumn",commands:[{
                                            xtype:"button",command:"cmdDelete",iconCls:"#Delete"
                                        }
                                        ,{
                                            xtype:"button",command:"cmdEdit",iconCls:"#Pencil"
                                        }
                                        ],listeners:{
                                            command:{
                                                scope:,fn:function(item,command,record,recordIndex,cellIndex){
                                                    handleItem(command,  record);
                                                }
                                                
                                            }
                                            
                                        }
    What is the empty 'scope' Property ? I can see it on the Listener.Command but I don't understand the meaning ?

    Peter
  6. #6
    The "scope" is a scope in which the function is executed.
    http://docs.sencha.com/ext-js/4-2/#!...able-method-on

    Do you add a column during initial Page_Load? If so, please try to remove:
    editColumn.Listeners.ClearListeners()
    If it doesn't help, please provide a full test case to reproduce.
  7. #7
    Quote Originally Posted by Daniil View Post
    Do you add a column during initial Page_Load? If so, please try to remove:
    editColumn.Listeners.ClearListeners()
    Perfect ! That was the Problem :-)

    Thx Daniil

Similar Threads

  1. GridPanel Editable Validation
    By ermanni.info in forum 2.x Help
    Replies: 4
    Last Post: Oct 30, 2012, 8:03 PM
  2. Replies: 12
    Last Post: Sep 07, 2012, 2:42 PM
  3. Validation in Editable GridPanel
    By n_s_adhikari@rediffmail.com in forum 1.x Help
    Replies: 4
    Last Post: Sep 17, 2011, 5:35 PM
  4. [CLOSED] Editable GridPanel Validation
    By bethc in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Sep 22, 2009, 6:46 AM
  5. [CLOSED] GridPanel Not editable
    By speedstepmem2 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 26, 2009, 7:38 AM

Posting Permissions