[CLOSED] Tablegrid content update from listener

  1. #1

    [CLOSED] Tablegrid content update from listener

    Hi,

    Having some difficulties changing the content of the tablegrid:

    When clicking on a commandbutton in a grid I call the following handler:

    <Command Handler="if (#{windBerekening}){#{windBerekening}.hide();};#{pnlBerekening}.update(record.data.Berekening);#{winBerekening}.show();" />
    In the store (record.data.Berekening) there is a different HTML table in every record.
    So clicking on the commandbutton opens a window with a different TableGrid layout

    This is the window I would like to change the content:

    <ext:Window ID="winBerekening" runat="server" Title="Berekening" Icon="Calculator"
            Height="320px" Width="900px" BodyStyle="background-color: #fff;" Padding="5"
            Hidden="true">
            <Items>
                <ext:TableGrid ID="tgBerekening" runat="server" Table="data" StripeRows="true" Width="900" />
                <ext:Panel ID="pnlBerekening" runat="server">
                    <Content>
                        <table style="visibility: hidden;" id="data">
                            <thead>
                                <tr>
                                    <th>
                                        Omschrijving
                                    </th>
                                    <th>
                                        &nbsp;
                                    </th>
                                    <th>
                                        &nbsp;
                                    </th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td>
                                        Ingangsdatum contract&nbsp;
                                    </td>
                                    <td>
                                        :
                                    </td>
                                    <td>
                                        05-03-2011&nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Actuele looptijd (dgn)&nbsp;
                                    </td>
                                    <td>
                                        :
                                    </td>
                                    <td>
                                        545 dagen&nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Actuele looptijd (mnd)&nbsp;
                                    </td>
                                    <td>
                                        :
                                    </td>
                                    <td>
                                        17,9 maanden&nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Kilometers toegestaan&nbsp;
                                    </td>
                                    <td>
                                        :
                                    </td>
                                    <td>
                                        44750 km&nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Kilometers werkelijk&nbsp;
                                    </td>
                                    <td>
                                        :
                                    </td>
                                    <td>
                                        66908 km&nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Kilometers afwijking (pct)&nbsp;
                                    </td>
                                    <td>
                                        :
                                    </td>
                                    <td>
                                        (([Kilometers werkelijk] - [Kilometers toegestaan]) / [Kilometers toegestaan]) *
                                        100 = ((66908 - 44750) / 44750) * 100 = 49,5%&nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Kilometers verschil (abs)&nbsp;
                                    </td>
                                    <td>
                                        :
                                    </td>
                                    <td>
                                        [Kilometers werkelijk] - [Kilometers toegestaan] = 66908 - 44750 = 22158 km&nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Kilometers verschil (abs) per jaar&nbsp;
                                    </td>
                                    <td>
                                        :
                                    </td>
                                    <td>
                                        ([Kilometers verschil (abs)] / [Actuele looptijd (mnd)]) * 12 = (22158 / 17,9) *
                                        12 = 14855 km&nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Score (lookup pct)&nbsp;
                                    </td>
                                    <td>
                                        :
                                    </td>
                                    <td>
                                        49,5 = 1&nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Score (lookup abs)&nbsp;
                                    </td>
                                    <td>
                                        :
                                    </td>
                                    <td>
                                        14855 = 1&nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Score&nbsp;
                                    </td>
                                    <td>
                                        :
                                    </td>
                                    <td>
                                        ([Score (lookup pct)] * [GewichtPct]) + ([Score (lookup abs)] * [GewichtKm]) = (1
                                        * 50%) + (1 * 50%) = 1&nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Score (lookup kleur)&nbsp;
                                    </td>
                                    <td>
                                        :
                                    </td>
                                    <td>
                                        1 = Rood&nbsp;
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </Content>
                </ext:Panel>
            </Items>
        </ext:Window>
    I receive no errors and when using an alert I can see that I've the correct record.data.Berekening. But still.. the window shows the initial table content. The content of the label is never updated.

    Sorry that I can't give you up and running code, but the code is part of a large project with a lot of references.

    Simple said. It looks like that the TableGrid needs some kind of refresh ?

    Martin
    Last edited by Daniil; Sep 04, 2012 at 8:40 AM. Reason: [CLOSED]
  2. #2
    Hi,

    TableGrid gets an HTML table and accordingly configures Store and ColumnModel within its constructor. There is no more any relation between a TableGrid and an HTML table, i.e. it's not updated according changing of the HTML table and there is no functionality to refresh the TableGrid.

    A single way to achieve your requirement - rerendering the TableGrid, either client side

    1. Destroy the exiting TableGrid.
    2. Create a new one
    new Ext.grid.TableGrid(config);
    or server side

    1. Make an AJAX request (a DirectMethod would be best in your case)
    2. Call the Render method of the TableGrid.
    Last edited by Daniil; Sep 03, 2012 at 2:48 PM.
  3. #3
    Thanks for the advice Daniil.. will look into those solutions.

    Martin
  4. #4
    Quote Originally Posted by Daniil View Post
    Hi,
    1. Make an AJAX request (a DirectMethod would be best in your case)
    2. Call the Render method of the TableGrid.
    Did the trick .. thanks ! Mark as solved

    Martin

Similar Threads

  1. Update Controls and Content during a DirectEvent
    By HosseinHelali in forum 1.x Help
    Replies: 1
    Last Post: Jul 12, 2011, 10:15 AM
  2. Replies: 0
    Last Post: Oct 19, 2010, 7:39 AM
  3. [0.8] Update content with AjaxEvent.
    By mojo in forum 1.x Help
    Replies: 0
    Last Post: Oct 14, 2010, 3:01 PM
  4. [0.8.2] Update Content
    By thchuong in forum 1.x Help
    Replies: 2
    Last Post: Jun 18, 2010, 2:31 AM
  5. [CLOSED] GridPanel: modify cell-content from listener (script)
    By andreas.seitz in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 21, 2009, 12:00 PM

Posting Permissions