Hello all!
I use additional URL part - a tail part of the URL doesn’t correspond any view - as a parameter carrier.
My URL looks like that
http://localhost:8080/#!/top/objectBrowser/obj0000200000001
I can synchronyze a view state with the [urlChange] view method, but I don’t know how I can do the same in opposite way: set additional URL part.
In short, I need two-way sunchronization URL<->ViewState.
If I use either [JetView#show] or [JetRouter#set] method then I get corrupted URL without [objectBrowser] part.
Colud someone tell me solution of this problem, please?
Well, I’ve been forced to implement the next logic
let currUrl: string = this.app.getRouter().get();
let urlParts: string[] = currUrl.split("/");
urlParts[urlParts.length - 1] = objectIdInput.getValue();
let newUrl: string = urlParts.join("/");
this.app.getRouter().set(newUrl, {silent: true});
It’s not very nice, from my point of view.
Moreover, there isn’t clear description of the the [IJetRouter#set] method options on the
doc. page
I’ve found out that HashRouter is based on the Routie library and I was able to looked out for options in this library source - [webix-routie/lib/routie] module.
There is the UrlParam plugin
inside of objectBrowser.init you can have
this.use(plugins.UrlParam, ["id"])
and now you can use the default params API
var id = this.getParam("id");
this.setParam("id", "13ku128218", true);
Hello Maksim!
Thank you for your advice.
This solution is exactly what I want.