Idea: Update of merge fields in labels with changes in the model

  • 4
  • Idea
  • Updated 5 months ago
  • Planned
I have tab labels that uses merge syntax to display the total number of records in a model. When I update and requery that model using action framework, the label does not update so the total number of records shown in the tab label is inconsistent with the number of actual records displayed in the table within that tab. It would be nice if there was a way to trigger update of merge variable values upon requery.
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,552 Points 10k badge 2x thumb

Posted 3 years ago

  • 4
Photo of Matt Sones

Matt Sones, Champion

  • 31,944 Points 20k badge 2x thumb
yes!
Photo of Matt Sones

Matt Sones, Champion

  • 31,944 Points 20k badge 2x thumb
Raymond, as a temporary work-around I usually run a one-line snippet right after the query, which looks something like this:

skuid.$C('MyComponentId').render();
Photo of Matt Sones

Matt Sones, Champion

  • 31,944 Points 20k badge 2x thumb
Tabsets are not tied to a model, which is the reason they don't re-render automatically on your query.
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,552 Points 10k badge 2x thumb
You are the best! Thanks
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,552 Points 10k badge 2x thumb
You are still the best, but I am now realizing that due to the number of components that I do this on and the number of action sequences that lead to updating of models tied to these merge variables on those components, I would have to add this action about 32 times just for my one page. Obviously, it would be preferable if Skuid could know to update them automatically. In the short-term.... Time to get to typing....
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,552 Points 10k badge 2x thumb
Actually, I'm rethinking it. I should be able to do a model action that updates the components on requery of the model. That bypasses each individual action sequence so I should only have to do it once per model.
Photo of Karen Waldschmitt

Karen Waldschmitt, Official Rep

  • 8,700 Points 5k badge 2x thumb
Gentlemen~

Raymond, this is an interesting idea. I'll bring it to the team and see what they think about including this in a future release.

Matt, thanks for your snippet workaround! Glad it works for Raymond in the meantime!  

Thanks!
Karen
Photo of Zach McElrath

Zach McElrath, Employee

  • 51,588 Points 50k badge 2x thumb
In the upcoming Brooklyn release, global merges, such as {{$Model.Account.data.length}} will automatically update when the number of records in a Model changes. This will address the principal concern here, where folks are using global merges in Tab labels to show the number of records in the Model whose data is shown in a tab.
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,552 Points 10k badge 2x thumb
Hi Zack,
I am now on 9.5.5 and I am still not seeing this updating behavior. As an example, I have a tab with a label of
Service Requests ({{$Model.ServiceRequestDashboard.data.length}})
The length does not update when I apply table filters or query the model through actions.
Photo of Korey

Korey

  • 1,162 Points 1k badge 2x thumb
Did this ever get resolved? It seems like the problem still exists.
Photo of John Dahlberg

John Dahlberg, Champion

  • 3,574 Points 3k badge 2x thumb
We've run into a similar issue with the global merge variables not refreshing in a navigation component when a model updates.  The Navigation component also doesn't handle the render() function well.  This isn't ideal, but the workaround was to wrap the component we needed to refresh with a component that does respect the render() function - a responsive grid in our case, but a wrapper should work as well.
Photo of Korey

Korey

  • 1,162 Points 1k badge 2x thumb
Thanks for this info John; just to make sure I understand correctly: You're throwing a responsive grid around a navigation component and then using JS to call render()? or is putting the responsive grid around the navigation component by itself sufficient?

Thanks again!
Photo of John Dahlberg

John Dahlberg, Champion

  • 3,574 Points 3k badge 2x thumb
You have to run the render() function on the responsive grid.  This can be a one line snippet run from the action framework.  In our case, we have a model that re-queries every 10 seconds and then kicks off a re-usable action that runs the snippet.  Like I said, this isn't ideal and causes a screen flicker, but it gets the job done.  We're using it for an "Alert" navigation component, kind of like an inbox notification for several types of transactions.  The syntax that Chis documented should suffice for the snippet and here's a screenshot of how we're leveraging the solution:

:
Photo of Korey

Korey

  • 1,162 Points 1k badge 2x thumb
Thanks John, I appreciate the clarification!
Photo of Chris Mollan

Chris Mollan

  • 570 Points 500 badge 2x thumb
okay, thanks.  Any workaround until then?  I am trying to use this to update the tab label

skuid.$C('sk-1xt3wk-1107').render();

It works for template id's but not for tab ids?