Hi,
I'm trying to implement a database-aware, editable repeating section using TWebDBResponsiveGrid. My plan was to use the OnItemClick event of the grid to bind various database controls—such as TWebDBEdit, TWebDBLookupComboBox, etc.—to the corresponding item elements I manually defined inside Options.ItemTemplate.
So far, TWebDBEdit appears to work correctly for the currently selected item. However, as soon as I click on a different record, the value displayed by the control changes to that of the newly selected record. This behavior suggests the control is not properly isolated per item and might be retaining binding from previous selections.
I've also tried binding TWebDBLookupComboBox, but I'm unsure how to correctly display the expected value for each item. Any advice on best practices for this would be appreciated.
Another issue I'm facing involves calling a procedure from a button located inside the grid's item template. When I do so, ResponsiveGrid seems to be undefined from within that procedure, making it impossible to interact with or reference the grid correctly.
I've attached a simple demo to help illustrate the problem more clearly.
Ps: Using the TWebDBResponsiveGrid for editing is very strategic in professional applications where data must be tabular, but editing it in a grid isn't possible or convenient (especially on tablet or smartphones). It's really important for setting up our new advanced applications.
Thanks in advance!
RepeatingSection DBResponsiveGrid.zip (62.2 KB)
TWebDBEdit is bound to the dataset and shows the active record of the dataset.
It is normal that when you would try to use a TWebDBEdit in a grid cell and have the TWebDBEdit bound to the dataset, it will still show the active record which is not always the same as the record shown in a grid cell.
If you want the value of the grid cell to be editable, use a regular TWebEdit and add the logic to set/get the text of this TWebEdit.
While using non-database-aware components might simplify implementation, it would be extremely valuable to have an event trigger prior to onItemClick. This would allow us to perform essential checks, validations, and other operations before the dataset is permitted to scroll and change the selected Item of the grid.
Currently, we've managed to use the db-aware approach ( the only exception being the above-mentioned html select => TWebDBLookupCombobox ) and approximate that behaviour by using the BeforeScroll event of the DataSet, but it would be far more intuitive and maintainable if it were directly bound to the grid component itself.
Our goal is to enable editing operations within the layout shown below:
You want to somehow block item selection in certain condition? Do I understand correct that you as such like to intercept a click on an item?
That is correct, yes.
Ideally, what I need is an event pretty much like the onCan... events of your FNC Data Grid component, that fires between the physical action of clicking an item and the internal operations of scrolling the DataSet and changing the active item in the Responsive Grid.
Hi Bruno,
Let me be clearer :-)
If I make changes to a record (via TwebEdit or TWebDbedit, for example), I need an event that allows me to handle the situation BEFORE leaving the current item (panel), both for checks and diagnostics, but above all to assign editor values to the dataset's fields and post the record. This must happen BEFORE the TwebResponsiveGrid changes the current record, with an onClick on another item.
Therefore, with onItemClick I can assign the current record's values to the editors, but first I need an "onItemLeave" or "onItemExit" to assign the editor values in the dataset for the previously selected record.
We need onItemExit (to assign values in the current record, before TwebResponsiveGrid changes the record) as well as onItemClick (to assign values on the new current record).
Beyond these, any other event (or feature) useful for achieving this management is welcome, especially using the TWebDbxxx editors.
From in-depth analysis conducted while porting our desktop software, this management system is the only truly effective way to view and edit data all in one, especially because it's RESPONSIVE and because editors and/or buttons can be displayed or hidden record by record, depending on the data contained. This cannot be achieved with the DBGrid alone, especially when editing on smartphones, because an additional form is required to edit the record, resulting in a less elegant and cumbersome result.
Enhancing the TwebResponsiveGrid by adding editing capabilities leads to web solutions that are easier to develop logically, therefore more intuitive for the user, and therefore very powerful.
We're essentially asking for a port of the old TDBCtrlGrid component, with a free-form layout. But it can take full advantage of RESPONSIVE functionality on the web.
We bet everyone would use it? 
Thanks in advance.
We checked and what we can do already is add an event to TWeb(DB)ResponsiveGrid OnBeforeItemClick with a var Allow parameter and when you set this to false, no further processing will be done.
Editing in TWebResponsiveGrid can be done now via a template item that contains HTML INPUT elements but for processing, that will require some extra glue code.
Ok, Bruno.
The important thing is that the event is fired BEFORE the component changes the current record.
Thanks.
That would be the case indeed.
Hi Bruno,
When is the update planned?
We're looking forward to testing the new event, which will allow us to use the grid in a different (innovative) way. Thank you.
We plan this to be in sync with the update for Delphi 13, so that should be imminent.