Many database-driven applications use grids to display data content. In PHsPeed, you can generate these grids quite easily by selecting a grid application type, select a table, and let PHsPeed generate a basic form and code. You can even generate a full working grid with a combined crud form this way.
But we have had a lot of requests for a more advanced grid, for example, to be able to host a subgrid in a row. To have grouping options. In this short blog, I want to give some insights into the upcoming version that is expected to be released in mid-august.
So how does this look like?
In the above sample, you can see a master-detail grid where the detail is in the row. The detail will be generated dynamically when clicking on the + or the full row, depending on its configuration. Because we wanted to make it possible to host all kinds of data in a row, think of charts, or other objects, we decided to build this feature upon the use of building blocks. Building blocks are reusable elements in your project that can be used in any other form. The most know building block is a header, a menu, a search form, but also a master-detail relation.
So how to build a master-detail relationship between two different modules? Actually, it is as simple as having a master-detail relationship on one form, where you assign a master table to a detail table and make a key-mapping. Only in this case, the detail table is in a different module, and we need a building block host component to import the building block. Here, the building block host component will be responsible to maintain the connection between the master and the detail, so you define the mapping and relationship in this component.
If you generate the code you will have the original grid and the detail grid as two separate grids. The only thing to do is to assign the building block to the master grid rows. Again, you can use some properties to achieve this. the end-result will be something as the image shows.
Happy (low) coding!