Automatic tests for grid, field names problem

  1. #1

    Automatic tests for grid, field names problem

    The fields in the grid have dynamic names like #ext-gen1583. I would like to add some automatic tests and for this, I need to have fixed names for fields in the grid.

    Is this possible and how to do it, if it is?

    I have tried to add an ID("Amount") for example to the X.Column() definition but this is not visible when the grid is rendered.
  2. #2
    Hello, @elector!

    You can't really give IDs to grid row cells as they are likely dynamically rendered on screen. That's particularly true if the grid has more results than what the screen can show without a scrollbar. If you rely on what's rendered on the page, rows will be missed, and potentially have different DOM rendered rows as the grid is scrolled up and down.

    For smaller grids with very few records this could be safe. To ensure a consistent DOM, it is possible to disable dynamic row rendering (buffered rendering) of the grid's store with BufferedRenderer="false". This will make all grid rows to be rendered at once when the page is loaded.

    Then to get a row's DOM based on this simple grid panel example: App.GridPanel1.getView().getRow(num), from 0 to the number of records (less one, it's a zero-based index array); or from 0 until it returns null.

    Likewise, it would be possible to get the whole DOM table, representing the view, using CSS/javascript selection if relying in Ext.NET's client side code (Ext JS) isn't desired. Then walking through the rows <tr> and cells <td>.

    Specifying an ID to every grid's cell is not supported as it potentially breaks many other features of the grid. If you need to validate the data, getting the records via App.GridPanel1.getStore().getAt(index) should be the way to go. Disabling BufferedRenderer could potentially make the cell IDs static, as long as there's nothing else "dynamic" across the page that might increment the global component count.

    Hope this helps!
    FabrĂ­cio Murta
    Developer & Support Expert
  3. #3
    Thank you very much Fabrizio
    I was thinking of using Playwright for testing UI but that will not be possible then.
    Do you have maybe some examples of how the EXT.NET components are tested? A practical example I could follow?
    I am using MVC for my project

    Thank you

Similar Threads

  1. [CLOSED] automatic data moving from bottom to top in grid panel
    By Vasudhaika in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: May 28, 2014, 5:26 AM
  2. Prevent automatic trim in Grid Cell
    By inaltec in forum 1.x Help
    Replies: 6
    Last Post: Dec 13, 2012, 4:23 PM
  3. Store - Exclude field names from data
    By glenh in forum 1.x Help
    Replies: 3
    Last Post: May 01, 2012, 7:05 AM
  4. [CLOSED] Date Field shows incorrect day names
    By randy85253 in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Sep 30, 2010, 5:47 PM
  5. Automatic grid size, in width and height.
    By Galo Q in forum 1.x Help
    Replies: 1
    Last Post: May 12, 2010, 12:12 PM

Tags for this Thread

Posting Permissions