How can I call a DirectEvent o a GridPanel column with a command?

  1. #1

    How can I call a DirectEvent o a GridPanel column with a command?

    Hi guys, I have a GridPanel that has a column with 2 ImageCommands, I would like to show a window upon clicking on those icons, and I need to pass the clicked row unique id to the window in order to load the data,, I saw a demo with a Listener but can you help me reading the id from the DirectCommand or Can I call the window and pass the clicked row ID value using a Listener as well? It would be nice to learn both approaches.
    Thank you

    Grid Column
    <ext:Column DataIndex="dep_id" Width="55" Header="Actions" Align="Center" Sortable="false">
    <Commands>
    <ext:ImageCommand CommandName="Edit" Icon="Pencil" ToolTip-Text="Edit"></ext:ImageCommand>
    <ext:ImageCommand CommandName="Print" Icon="Printer" ToolTip-Text="Print"></ext:ImageCommand>
    </Commands>
    </ext:Column>
    Grid Event
    <DirectEvents>
    <Command OnEvent="gridDataEdit_Click"></Command>                                        
    </DirectEvents>
    <LoadMask ShowMask="true" />
    Code Behind
    protected void gridDataEdit_Click(object sender, DirectEventArgs e)
    {
        X.MessageBox.Alert("Alert", "You clicked me and your ID is???").Show();
    }

  2. #2

    RE: How can I call a DirectEvent o a GridPanel column with a command?

    I already tried e.ExtraParams["ID_Field"] but it doesn't return anything.

    Anyone could please help me?
    Thanks
  3. #3

    RE: How can I call a DirectEvent o a GridPanel column with a command?

    Just adding some information, I tried the following code on the grid:

    <DirectEvents>                                        
       <Command OnEvent="gridEdit_Click" Buffer="250">
          <EventMask ShowMask="true" />
          <ExtraParams>
          <ext:Parameter Name="command" Value="command" Mode="Raw"/>
          <ext:Parameter Name="dep_id" Value="record.data.dep_id" Mode="Raw"/>
       </ExtraParams>
       </Command>
    </DirectEvents>
    and the following code behind:

    
    protected void gridEdit_Click(object sender, DirectEventArgs e)
    {
       X.MessageBox.Alert("Alert", "Command "+ e.ExtraParams["command"]
     +", id #: " + e.ExtraParams["dep_id"]).Show();
    }
    But the ID field doesn't return anything, can I get some advise?
    Thanks!
  4. #4

    RE: How can I call a DirectEvent o a GridPanel column with a command?

    After some self help here is the only solution I found, I wish I didn't have to hide columns to do that....

    My grid contains this:

    <Reader>
    <ext:JsonReader IDProperty="dep_id">
    <Fields>
    <ext:RecordField Name="dep_id"/>
    ...
    ...
    and...

    <ColumnModel ID="ColumnModel8" runat="server">
       <Columns>
       <ext:Column 
    DataIndex="dep_id" Hidden="true" />
       ...
       ...
    and...

    <ext:CommandColumn Width="55" Header="Actions" Align="Center" Sortable="false">                                            
       <Commands>                                               
          <ext:GridCommand CommandName="Edit" Icon="Pencil" ToolTip-Text="Edit">                                                        
          </ext:GridCommand>
          <ext:GridCommand CommandName="Print" Icon="Printer" ToolTip-Text="Print">
          </ext:GridCommand>
       </Commands>
       </ext:CommandColumn>
    and..

    <DirectEvents>                                        
    <Command OnEvent="gridActiongridAction" Buffer="250">
    <EventMask ShowMask="true" />
    <ExtraParams>
    <ext:Parameter Name="command" Value="command" Mode="Raw"/>
    <ext:Parameter Name="dep_id" Value="record.data.dep_id" Mode="Raw"/>
    </ExtraParams>
    </Command>
    </DirectEvents>
    and some code...

    protected void gridAction(object sender, DirectEventArgs e)
    {
       X.MessageBox.Alert("Alert", "Command "+ e.ExtraParams["command"] +", id #: " + e.ExtraParams["dep_id"]).Show();
    }
  5. #5

    RE: How can I call a DirectEvent o a GridPanel column with a command?

    Hi,

    Column is not required, you can omit column for id field


    1. Define IDProperty="dep_id"
    2. Add extra parameter
    <ext:Parameter Name="id" Value="record.id" Mode="Raw"/>
  6. #6

    RE: How can I call a DirectEvent o a GridPanel column with a command?

    vladimir (6/23/2010)Hi,

    Column is not required, you can omit column for id field


    1. Define IDProperty="dep_id"
    2. Add extra parameter
    <ext:Parameter Name="id" Value="record.id" Mode="Raw"/>
    Thank you very much Vladimir, I previously tried "record.data.id", that's why it didn't work, where can I find a help file for things like these?
    Paul

  7. #7

    RE: How can I call a DirectEvent o a GridPanel column with a command?

    thanks for the post, I used the same for my work also to edit and delete buttons, how can i add a confirm message box (yes/no) to my delete button ?
  8. #8

    Error

    Sorry, I want to write other post.
    Last edited by Lisseth; Sep 02, 2016 at 7:50 PM. Reason: error

Similar Threads

  1. Replies: 8
    Last Post: Dec 20, 2017, 1:52 PM
  2. Add command column in gridpanel
    By tmducit in forum 1.x Help
    Replies: 1
    Last Post: May 27, 2011, 11:27 AM
  3. GridPanel Column Command?
    By peter.campbell in forum 1.x Help
    Replies: 1
    Last Post: Apr 08, 2011, 9:13 AM
  4. [CLOSED] LinkButton command column in GridPanel
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Oct 21, 2010, 8:38 PM
  5. [CLOSED] GridPanel Command Column Does not Work!
    By Immobilmente in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Mar 30, 2009, 5:26 AM

Posting Permissions