mind_id_field_list is a list of properties (mine_id, mine name, and 3 others )
mind_id_field_list_dg is the list I need to populate that will be used to fill the data row logic
the selectedmine and all of its data has been pulled into "selected_mine_id_data " but there are 30 items here and I want to put only the five listed in “mind_id_field_list” into my data grid
two columes Name and Value
so for each item in mind_id_field_list i add an item to the list with Name=‘j’ and Value= get property “j” of selected_mine_id_data
basically my database table has 30 columns. I’m going to break those into 5 data grids (by attribute group. )
I hope this gives a better understanding of what I’m trying to accomplish
If I understood you correctly, you want to take the first 5 items from selected_mine_id_data (in my example, data) and put them in mind_id_field_list_dg (in my example, it is list_dg) by name of the property from mind_id_field_list (in my example, it is list).
My example:
when a user selects a mine, I run a query against the mine_data table and load all 30 fields (columns ) into a variable like so stored in variable “selected_mine_id_data”
so a walk though the list of columns (mind_is_field_list) so a create an object with name set to the jth item in mind_is_field_list then I set the value to be selected_mine_id_data[j]
then I add this to list mind_id_field_list_dg
I have a database table (mine_data ) which has 30 columns. mine_id is a unique ( 1 of the 30 columns )
user choses a mine_id on which to see all the mine details (all 30 columns of data)
so I pull all the mine info into variable and I know only one row will be returned because mine_id is unique.
as all the mine information (columns ) fall into 5 groups. to keep it simple 5 groups * (5 or 6 entires per group ) . I plan to use 5 data grids to show each of these groups.
so I created a list of the first 5 columns “mind_id_field_list”
I created an empty list “mind_id_field_list_dg” to hold the list of Name,Value (s) where Name will be the column name and Value will be the value of mine_id → column
here is an example
as you can see the “name” column here are the mine_data columns and the value is the mine_id (see first row ) on the mine_data for that mine for “Name” column.
Let me know if you have any questions.
also, thanks again for your (all of you) time.
H
I want to display all 30, but not in one data grid. My thought on this is assigning all 30 all at once into a variable then parsing the variable to pull out each group of fields means I only access the database once, then populating each data grid is a local operation.
Both Data Grid and Data Table components work with the assumption that every row is a separate object. You’re trying to render a single object over 5 rows. I think this causes the misunderstanding and the technical challenge. While it is possible what you’re trying to do, I honestly believe you would be better off creating a Block or Container-based element that uses Text components to bind to the appropriate columns/fields in the object you’re working with. This would be a tremendous simplification of your app without losing any functionality. Have you given any thought to that approach?
I did think about using input blocks, and then using the binding logic to deal with content. But I’d have to make 30 of them with 30 different bindings which is a lot of properties to set.
my thought was: create a list of related fields(columns) then create a new list of objects with the column name as the first field (Name) and value as the mine_id/column name.
I don’t think this is a single object over 5 rows but a list of objects with two fields populated the name of a column and the value in the database row of mine_id (row) and column.
It is one of the approaches and not the worst of them. It has one big advantage – it is highly extensible (to any number of fields), if really need it.
Another approach is to create a custom component with the custom logic and rendering, but it may be not trivial.
By the way, did you try to work with JSON as a type of a field - it can contain a complex object/array?
The issue I am seeing when I build my list using a property “datagridtestlist” of page data and then set the datagrid row logic to be that property
the data grid is blank
but when I create the list as a variable then store the variable in a property of page data
I get this
the only difference between these data grids is the first one gets the property from page data. while the second one the list is created in a var and then saved to a property.
I created a test page to show the issue.
app id 9359F741-6D5D-AEF2-FF22-4834A2050400
container : default_test_9_21_23
page name: data_grid_test_page
to use, load the page. Then click on any of the 4 entries in the top data grid.
the first data grid shows nothing while the second one works as expected.
but then I print out the contents they look identical
I created a copy of that page and made a minor change in the “on cell clicked” event.
One of the most significant issues I see in your logic (and it is everywhere) is that you do not use variables at all for any intermediate values you’re storing. Instead, you store everything in Page Data. This is highly inefficient because every time you put anything into Page Data, it forces the re-rending of the entire page. Additionally, it causes the problem you’re seeing, specifically, you put an empty list into Page Data and then you modify it, however, that does not trigger re-render, as a result, the data grid is never refreshed with the new data.
your saying if a property in pagedata is set to an empty list, that when it is updated (so it is no longer empty) it is never re-rendered? I think this is the first time initializing a variable (I guess technically its a property not a variable) before using it actually caused an error.
If you update a list inside of PageData, the PageData itself does not see any changes, as a result, there is no re-render event.
I am not sure what error you’re referring to. Did you see the page with my changes? It is called marktest, there are no errors on that one and all data grids are being populated with data.
Ok so if a property is stored in page data as an empty list and then that property is updated it will not rerender so the change will not be seen.
so I added a new datagrid and tried this
so here I am setting property datagridtestlist2 to an empty list.
then I update it.
if changing the empty list so it has data does not cause a rerender I would expect the data grid using it to be blank but its not. It shows the data.
for example
here I start with a property set to empty list. then I add to the list. but it should not cause a rerender so I should not see the data grid update. but I do.
so whats the difference? in both I start with an empty list. In both I add items to the list. but in one I see the data in the data grid but in the second I don’t see the data.
I feel like there is a fundamental concept I’m missing.
In the logic below you assign an empty list to a property in Page Data. That causes a re-render event. After that you modify the list. Yes, the list will be updated, however, the UI will not know that it got updated because PageData was not modified (only its contents did):