Hi, i want know if it’s possible change the dataProvider in this case, i need this because that route of dataProvider is diferent in two cases. I wanted to do with one ‘if’ and assign it later.
change the dataProvider of a field?
that can be done by using the solutionModel
But if posible to using the solutionModel in a form that is using actually? fisrt we have to remove from history, no? and later ussing the solutionModel. But if not posible if in every moment is showed the form, no?
you want to change a dataprovider on the fly when the form is visible?? Why is that?
But that is not possible.
If you just want to show certain data in a tableview column that depends on something you could use a calculation that shows X or Y depending on Z
Actually I can see some point in what our friend is asking. I’ve always wondered why you can’t just alter the form without the need to first remove it from history and the solution model. I think it makes quite cumbersome a task which becomes more and more necessary the more complex problems one comes to tackle. Is there any specific reason why it has to be that way?
This is a table view right ?
Then you can simply get the form object using the solutionModel and remove the field from the form and recreate a new one with a another dataprovider from the same datasource. After this you call controller.recreateUI() and it shows. No need to remove it from history.
But if this column is for read only purposes you could also simply use an unstored calculation like Johan suggested or you have the different columns on the form already and you hide/show them when needed.
Hope this helps.
ROCLASI:
or you have the different columns on the form already and you hide/show them when needed.
In v6 there’s a bug doing this in combination with the onRender function.
Case is filed, should be solved in v6.06
In v6 webclient my experience is that columns/headers are not aligned anymore using this trick.
There’s one other option to resolve the problem:
- Create 1 parent form without the fields you want to swap.
- Create 2 forms which will extend the parent form and add the fields you need.
- Swap the form on a tabpanel at runtime.
Hope this helps
Thanks ROCLASI for the info, that’s work! We use the controller.recreateUI function, after made the change with the solutionModel, and we can change the dataprovider onLive, including seeing the form. Thanks a lot, another time!