gridpanel commands with javascript

  1. #1

    gridpanel commands with javascript

    I need to have a gridpanel with these 3 options on it:

    1) each time the user clicks on the row(any column except the next 2 columns), it needs to fire a client chart reload(this chart is inside the same page below the gridpanel) (cht.store.reload(); cht.redraw();)

    2) in the same row of the grid, I need to have a column (button or command or image), when the user clicks on it, it must activate a tabpanel's panel and change the title of it ( tabpanel.setActiveTab(panel);panel.setTitle(tl);)

    3) in the same row of the grid, I need to have a column(button or command or image), when the user clicks on it, this must happen an onevent cycle, like the next:

    <DirectEvents>
                                    <CellClick  OnEvent="grdPShow" Success="top.GApp.wndHdr(#{wndP},2);">
                                        <EventMask ShowMask="true" CustomTarget="={#{grdP}.body}" />
                                        <ExtraParams>
                                            <ext:Parameter Name="xP" Value="record.getId()" Mode="Raw" />
                                        </ExtraParams>
                                    </CellClick>
                                </DirectEvents>

    Summary:
    - on select or click the row triggers a javascript
    - on click on a command button, triggers a javascript
    - on click on a command button, fires a directevent call


    So, how can I achieve this?
    Last edited by Daniil; Nov 10, 2014 at 12:57 PM.
  2. #2

    A solution

    This is a way I workaoround with the request I did:

    1) The first column I have an hyperlink (instead of a command)

        linkN : function (value, metadata, record) {
            return Ext.String.format("<a href=\"#\" onclick=\"LApp.onN('{1}')\">{0}<a/>", top.GFn.zFill(record.data.Id,4), record.data.Periodotrabajo);
        },
         <ext:Column runat="server" Text="Id" DataIndex="Id" Width="40">
                 <Renderer Fn="LApp.linkN" />
          </ext:Column>
    2) I declare a command column for the OnEvent:
                    <ext:CommandColumn runat="server" Width="25">
                                            <Commands>
                                                <ext:GridCommand Icon="BulletEdit" CommandName="EP" />
                                            </Commands>
                                            <DirectEvents>
                                                <Command  OnEvent="grdPShow" Success="top.GApp.wndHdr(#{wndP},2);">
                                                    <EventMask ShowMask="true" CustomTarget="={#{grdP}.body}" />
                                                    <ExtraParams>
                                                        <ext:Parameter Name="xP" Value="record.getId()" Mode="Raw" />
                                                    </ExtraParams>
                                                </Command>
                                            </DirectEvents>
                                        </ext:CommandColumn>
    3) For the selection of the rows with chart reload :
              <SelectionModel>
                                    <ext:RowSelectionModel runat="server" Mode="Single">
                                        <Listeners>
                                            <Select Handler="top.GApp.chrR(#{cht1});" Buffer="250" />
                                        </Listeners>
                                    </ext:RowSelectionModel>
                                </SelectionModel>

Similar Threads

  1. Replies: 0
    Last Post: Aug 20, 2012, 2:58 PM
  2. Image commands icons in IE6
    By snagy in forum 1.x Help
    Replies: 0
    Last Post: Mar 03, 2010, 2:08 PM
  3. Styling Grid Commands
    By Summ0ner in forum 1.x Help
    Replies: 1
    Last Post: Feb 02, 2010, 2:40 PM
  4. [CLOSED] Cell commands seem to be broken
    By brettmas in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Aug 24, 2009, 4:30 PM
  5. Set disable menu commands
    By DGil in forum 1.x Help
    Replies: 2
    Last Post: Jun 19, 2009, 8:13 AM

Posting Permissions