-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dynamic tab coloring based on relationship content #1
Comments
Hi Angela, I have a few thoughts on your "cons" list: Current version uses many repeating AML queries.When an item form opens for the first time, only the parent item and the active relationship tab's items are loaded into the dom. No data is retrieved for the inactive tabs, so you'll definitely need to query the server for that data. One possibility to reduce the number of calls to the server is to make one call that retrieves minimal data for all relationships, and then use XPath to parse out the result and decide how each tab should be styled. Example pseudocode:
This is risky (performance-wise) because some items may have thousands of related items, but minimizing the properties returned should help reduce the performance hit (less data returned from the server).
You can also try making the changeTabColor call asynchronous so it doesn't prevent the rest of the form from loading. Large ItemTypes with many relationship tabs (e.g. Part) sometimes doesn´t color the tabs.You can try increasing the timeout value to give the function more time to finish. Ex:
I underrated the amount of Relationships that use alternative content in Relationship Views (reverseItemsGrid, TreeGridViews, etc.). Highlighting these kind of content would require additional queries.I'm not sure there is a good generic solution for this use case. I think admins would need to define their own queries for these tabs. Maybe some type of "query template" field could be added to the Ext_SetTabColor item. If the field is set, it would be used to override the query for the RelationshipType. |
Hi Eli, Thanks for your very detailed feedback! This helps me a lot and I'll try to test your suggestions soon. I don´t know yet if I really will use these kind of tab highlighting later in production. But I'm always a big friend of trials. And finally there is already a first positive and very important result: The main "set-tab-color" project works again. :-) Angela |
What about setting "maxRecords='1'" on the related item, as you only need to know if there is at least one item? \Ralf |
Good suggestion, Ralf. That should help. |
Thanks for the additional input! I haven´t worked much on this topic. I wonder if it would make sense to split this issue into a separate GitHub project? |
I think it would make more sense to update the current project instead of create a new one. If this use case is implemented as a separate project, the community would have to maintain common code between two repositories, rather than managing a single repo. One way to implement the new use case within the current project is to add a configuration option and then update the logic to check the option. For example, maybe add a property that allows the admin to say they want a style applied when:
This would be a great Hacktoberfest contribution to the community. |
"It somehow would be helpful if the tabs could indicate the content..." I have created a branch of the master tree that now contains static and dynamic coloring: Known issues:
Speed seems to be somehow ok. Also code needs review and more testing. |
I made some additional tests for my issue No. 1 - live update of tab style I was able to achieve a quite good first result with this Method in two variants for "OnInsertRow" and "OnDeleteRow" RelationshipType events.
But this one would now have to be added in any affected RelationshipType. |
Hi, I will try to add my two Methods automatically to the RelationshipTypes by extending the Method 'Ext_AddFormEvent.xml'. Angela |
This one is interesing: Obviously I wasn´t the first one with this idea. I like the "writer number of relationships" in tab label idea, also it costs a lot of performance. I am also facing the limitation with federation relationships. But it´s similar to limitation that you have with reverse and tgv relationships. It does not really bother me, as the color scheme tells user about the relationship type already. |
Hi,
I wonder if it´s possible to extend this project to some kind of dynamic tab coloring.
Idea: Tabs shall only be colored, if there are related items available. This way users could instantly see, which relationships are in use and which ones are empty.
Pros:
Cons:
I think the idea has its charme. What´s your opinion? Is there something to consider?
Best regards!
Angela
The text was updated successfully, but these errors were encountered: