Non unique view id: messages

I have a couple different files that have

var createModal = webix.ui({

When I switch between pages I get webix messages

Non unique view id: createModal

Do I need to use a different variable name for each one even though they are in different files?

Nope, the cause of the issue is id, not the variable name.
Most probably your code looks like next

var createModal = webix.ui({
   id:"createModal" // <= this value must be unique !

So ids need to be unique across all pages. Okay that is good to know.

I have changed the ids to be unique across all pages but I am still getting the same error. Even when I set the id to a random string.

@maksim hello! I have encountered the same problem in webix version 6. I changed the ids to be unique across all pages but I am still getting the same error. How can I fix it? Thanks!

Hello,

Can you share a problematic code, please?

@Nastja Thank you for your reply! When I click the “New” button, the message will appear in my web. But the snippet will not appear.

https://snippet.webix.com/lmz97ga1

Non unique view id : “category-win”
Non unique view id : “input_fac”
Non unique view id : “input_cust”

If you want to close ui.window, so you need to use close instead of hide.
hide just makes it invisible, while close destroys the ui.window.

But it is much better to hide and show one and the same window instead of recreating it multiple times: Code Snippet

@Nastja Thank you very much, it’s useful! By the way, can destructor method replace the hide method? When is it suitable to use destructor method?

@Karena ,
You are welcome!

destructor method destructs the calling object.
If the ui.window needs to be opened sometime or accessed while it is invisible, so hide method is used.
If ui.window needs to be completely removed from the application as a ui-element, so close method is used. In this case, if the ui.window is ever needed, it will have to be completely re-created.
If the ui.window has to be created and displayed via a button, the easiest way is to check if this ui.window is existed (if not, create it)

click(){
   if ( !$$("category-win") )
      webix.ui({ view:"window", id:"category-win", ... });
   $$("category-win").show();
}

And hide it via hide method