[CLOSED] Enable/disable drag/drop of grid rows from one to another

  1. #1

    [CLOSED] Enable/disable drag/drop of grid rows from one to another

    Hi,

    I have a grid panel for which I have a dradrop control inside grid view. I have enabledrop as "false" initially....When i try to set it to true in code behind, i
    am still unable to drop on this grid.

    Pls help me resolve this.

    Thanks,
    Veda
    Last edited by Daniil; Aug 20, 2013 at 10:15 AM. Reason: [CLOSED]
  2. #2
    Hi Veda,

    Yes, changing EnableDrop when a GridPanel is already rendered doesn't work.

    I can suggest the following solution.

    To disable dropping initially:
    <ext:GridView runat="server">
        <Plugins>
            <ext:GridDragDrop PluginId="dragdrop" runat="server" DragText="Drag and drop to reorganize" />
        </Plugins>
        <Listeners>
            <AfterRender Handler="this.getPlugin('dragdrop').dropZone.lock();" Delay="1" />
        </Listeners>
    </ext:GridView>
    To enable on the fly:
    grid.getView().getPlugin('dragdrop').dropZone.unlock();
  3. #3

    Enable/Disable drag and drop of grid panel.

    Quote Originally Posted by Daniil View Post
    Hi Veda,

    Yes, changing EnableDrop when a GridPanel is already rendered doesn't work.

    I can suggest the following solution.

    To disable dropping initially:
    <ext:GridView runat="server">
        <Plugins>
            <ext:GridDragDrop PluginId="dragdrop" runat="server" DragText="Drag and drop to reorganize" />
        </Plugins>
        <Listeners>
            <AfterRender Handler="this.getPlugin('dragdrop').dropZone.lock();" Delay="1" />
        </Listeners>
    </ext:GridView>
    To enable on the fly:
    grid.getView().getPlugin('dragdrop').dropZone.unlock();
    I Followed above suggestion but I get following error.
    Error: Unable to get property 'dropZone' of undefined or null reference

            <ext:Store ID="StoreDBScript" runat="server" PageSize="50">
                <Model>
                    <ext:Model ID="StoreModelDBScript" runat="server" IDProperty="DBScriptId" ClientIdProperty="DBScriptId">
                        <Fields>
                            <ext:ModelField Name="DBScriptId" />
                            <ext:ModelField Name="DBBuildId" />
                            <ext:ModelField Name="Name" />
                            <ext:ModelField Name="DBScriptType" Type="Int" UseNull="true"/>
                            <ext:ModelField Name="DBChangeType" Type="Int" UseNull="true"/>
                            <ext:ModelField Name="Description" />
                            <ext:ModelField Name="Reference" />
                            <ext:ModelField Name="Sequence" Type="Int"/>
                            <ext:ModelField Name="Script" />
                            <ext:ModelField Name="ChangedBy" />
                            <ext:ModelField Name="ChangedOn"/>
                        </Fields>
                    </ext:Model>
                </Model>
            </ext:Store>
    
            <ext:Viewport ID="ViewportDBScript" runat="server" Layout="VBoxLayout">
                <LayoutConfig>
                    <ext:VBoxLayoutConfig Align="Stretch" />
                </LayoutConfig>
                <Items>
                     <ext:GridPanel
                        ID="DBScriptGrid"
                        runat="server"
                        Header="False"
                        ColumnLines="True"
                        Region="Center"
                        EmptyText="No Records Found"
                        SortableColumns="true"
                        StoreID="StoreDBScript"
                        Flex="3">
                        <ColumnModel ID="DBScriptColumnModel" runat="server" Enabled="false">
                            <Columns>
                                <ext:Column ID="ColumnScriptName" runat="server" Flex="1" Text="Name" DataIndex="Name">
                                    <Editor>
                                        <ext:TextField ID="TextScriptName" runat="server">
                                        </ext:TextField>
                                    </Editor>
                                </ext:Column>
                            </Columns>
                        </ColumnModel>
                        <SelectionModel>
                            <ext:RowSelectionModel ID="RowSelectionModelDBScript" runat="server">
                            </ext:RowSelectionModel>
                        </SelectionModel>
                        <Plugins>
                            <ext:CellEditing ID="CellEditing1" runat="server" ClicksToEdit="1">
                            </ext:CellEditing>
                        </Plugins>
                        <View>
                            <ext:GridView ID="GridViewDBScript" runat="server">
                                <Plugins>
                                    <ext:GridDragDrop PluginId="DragDropDBScript" runat="server" DragText="Drag and drop"/>
                                </Plugins>
                            </ext:GridView>
                        </View>
                        <TopBar>
                            <ext:Toolbar ID="ToolbarDBScript" runat="server" Height="30" Flex="1">
                                <Items>
                                    <ext:Label runat="server" ID="titleDBScripts" Text="DB Scripts" Icon="ApplicationViewList" Cls="lblcss" Flex="1"/>
                                    <ext:Label runat="server" ID="Label1"  Cls="lblcss" flex="1"/>
                                    <ext:Button ID="btnEdit" runat="server" Text="Edit" Disabled="true" ToolTip="Edit Data">
                                        <Listeners>
                                            <Enable Handler="App.DBScriptGrid.getView().getPlugin('DragDropDBScript').dropZone.lock();" />
                                            <Disable Handler="App.DBScriptGrid.getView().getPlugin('DragDropDBScript').dropZone.unlock();" />
                                        </Listeners>
                                    </ext:Button>
                                </Items>
                            </ext:Toolbar>
                        </TopBar>
                    </ext:GridPanel>
                </Items>
            </ext:Viewport>
  4. #4
    Quote Originally Posted by aditya View Post
    I Followed above suggestion but I get following error.
    Error: Unable to get property 'dropZone' of undefined or null reference

            <ext:Store ID="StoreDBScript" runat="server" PageSize="50">
                <Model>
                    <ext:Model ID="StoreModelDBScript" runat="server" IDProperty="DBScriptId" ClientIdProperty="DBScriptId">
                        <Fields>
                            <ext:ModelField Name="DBScriptId" />
                            <ext:ModelField Name="DBBuildId" />
                            <ext:ModelField Name="Name" />
                            <ext:ModelField Name="DBScriptType" Type="Int" UseNull="true"/>
                            <ext:ModelField Name="DBChangeType" Type="Int" UseNull="true"/>
                            <ext:ModelField Name="Description" />
                            <ext:ModelField Name="Reference" />
                            <ext:ModelField Name="Sequence" Type="Int"/>
                            <ext:ModelField Name="Script" />
                            <ext:ModelField Name="ChangedBy" />
                            <ext:ModelField Name="ChangedOn"/>
                        </Fields>
                    </ext:Model>
                </Model>
            </ext:Store>
    
            <ext:Viewport ID="ViewportDBScript" runat="server" Layout="VBoxLayout">
                <LayoutConfig>
                    <ext:VBoxLayoutConfig Align="Stretch" />
                </LayoutConfig>
                <Items>
                     <ext:GridPanel
                        ID="DBScriptGrid"
                        runat="server"
                        Header="False"
                        ColumnLines="True"
                        Region="Center"
                        EmptyText="No Records Found"
                        SortableColumns="true"
                        StoreID="StoreDBScript"
                        Flex="3">
                        <ColumnModel ID="DBScriptColumnModel" runat="server" Enabled="false">
                            <Columns>
                                <ext:Column ID="ColumnScriptName" runat="server" Flex="1" Text="Name" DataIndex="Name">
                                    <Editor>
                                        <ext:TextField ID="TextScriptName" runat="server">
                                        </ext:TextField>
                                    </Editor>
                                </ext:Column>
                            </Columns>
                        </ColumnModel>
                        <SelectionModel>
                            <ext:RowSelectionModel ID="RowSelectionModelDBScript" runat="server">
                            </ext:RowSelectionModel>
                        </SelectionModel>
                        <Plugins>
                            <ext:CellEditing ID="CellEditing1" runat="server" ClicksToEdit="1">
                            </ext:CellEditing>
                        </Plugins>
                        <View>
                            <ext:GridView ID="GridViewDBScript" runat="server">
                                <Plugins>
                                    <ext:GridDragDrop PluginId="DragDropDBScript" runat="server" DragText="Drag and drop"/>
                                </Plugins>
                            </ext:GridView>
                        </View>
                        <TopBar>
                            <ext:Toolbar ID="ToolbarDBScript" runat="server" Height="30" Flex="1">
                                <Items>
                                    <ext:Label runat="server" ID="titleDBScripts" Text="DB Scripts" Icon="ApplicationViewList" Cls="lblcss" Flex="1"/>
                                    <ext:Label runat="server" ID="Label1"  Cls="lblcss" flex="1"/>
                                    <ext:Button ID="btnEdit" runat="server" Text="Edit" Disabled="true" ToolTip="Edit Data">
                                        <Listeners>
                                            <Enable Handler="App.DBScriptGrid.getView().getPlugin('DragDropDBScript').dropZone.lock();" />
                                            <Disable Handler="App.DBScriptGrid.getView().getPlugin('DragDropDBScript').dropZone.unlock();" />
                                        </Listeners>
                                    </ext:Button>
                                </Items>
                            </ext:Toolbar>
                        </TopBar>
                    </ext:GridPanel>
                </Items>
            </ext:Viewport>
    This question has been asked here:
    http://forums.ext.net/showthread.php?30201

Similar Threads

  1. [CLOSED] Enable Drag & Drop dynamically in a treepanel
    By bogc in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Dec 12, 2012, 6:35 AM
  2. Drag and Drop rows in single Grid
    By rthiney in forum 1.x Help
    Replies: 2
    Last Post: Dec 21, 2010, 9:41 AM
  3. [CLOSED] Drag & Drop Rows in Grid
    By macap in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Dec 21, 2010, 9:38 AM
  4. Replies: 1
    Last Post: Oct 14, 2010, 12:09 AM
  5. Replies: 6
    Last Post: Dec 17, 2009, 9:40 AM

Posting Permissions