I need load different database/tables depending on each user is loged in. I have tried the most obvious options but unsucessfully. I tried to modify the view object property url/save at onBeforeLoad event. I used onBeforeLoad inline, because it does not fires when attached externally. Below one of the options:
Thanks Listopad. However I am wishing I have missunderstood your answer.
One of the most powerfull features of webix is its data connector/processor ability to load/update data from components to/from database transparently. I realy would not like to loose this facility at last in this stage of evaluating the webix lib. Please let me remake my question in other words, so I could get a most favorable answer: " A treetable needs load/save its data from a database table which is working fine. But sometimes, a copy of this database table needs to be pointed to for load/save, but this copy is located on a different folder/diretory". How may I do it ?
There’s another way. If you’re using a data connector/processor, theurl transforms into an object with the source property. Therefore, an url can be redefined as
datatable.config.url.source = "new_url";
As forsave link, you can get and change it through the DataProcessor:
Thanks…work fine now. If we could find a way to execute code with the replacing paths during initialization of component would be even better. This way, should be possible to automatically open the last path/file the user was working with. If not, no problem I will try with cookie or something else.
If we could find a way to execute code with the replacing paths during initialization of component would be even better.
You can extend the component with help of protoUI, and in the constructor of a new component place a logic, which will set the necessary url and save values.
Does using the above solution break events onAfterUpdate functionality?
Mainly, the problem is the response JSON is not recognized. Therefore I am having problems passing the record id for simultaneous update after datatable row is inserted.
Has there been any other solutions since to dynamically define save url?
Mainly, the problem is the response JSON is not recognized
May be not related to url change. Check the status code of response ( it must be below 400, or result will be processed as an error ) Also, webix uses strict json parsing rules, so be sure that all JSON keys are wrapped in doublequotes.
I experimented not changing the url and the onAfterUpdate will fire successfully. The update also correctly reads the new id passed from the JSON response. Only after using webix.dp(datatable).config.url = "save.php"; does it stop working, though no errors are thrown. I can only guess that this config overwrites or resets the save options that were originally set.
I only needed this to pass a variable to the save url i.e. webix.dp(datatable).config.url = "save.php?option=XXX";, but I figured out a way to just pass this variable with a hidden column. Will look into the proxy objects.