Nesting WebixView in Webix

edited May 2014 in Technical questions

Hi, I'm wondering if it's possible to nest a WebixView inside a regular Webix view?
ie: instead of attaching the WebixView to a dom element.
The various examples all start with a topmost WebixView.
I'm asking if it's possible for this top level component to be a regular Webix view.
Thanks
David

Comments

  • Just to add to this question, looking at the source for this example:

    http://docs.webix.com/samples/30_backbone/02_nested_views.html

    It looks like you start with a WebixView parent (v1), which you render.

    Then, either:

    a) the child (v2) is rendered, and you manually replace a child ('left') of the parent with this child, ie:

    v1.getChild("left").setContent(v2.el);

    or

    b) you set the el of the child (v2) to a the child ('right') of the parent that you wish to replace, ie:

    el:v1.getChild("right")

    So, my questions are:

    1. can you start with a webix.ui as the parent?
    2. is it possible to include a WebixView in a webix.ui and then render it all once?
    3. is it possible to build this nested hierarchy without requiring view ids? (because, in a large app, you have to somewhere track these parent and child id's across different files.

    I guess I'm requesting a sample application that starts with a regular webix.ui parent, and then somehow includes children, some of which can be WebixViews.

    Alternatively, do you suggest that, if you are using Backbone, that the entire app is structured as children of a parent WebixView ??

  • edited May 2014

    A related question:

    Is it possible to set the data attribute of a list to a Backbone model??

    In other words, is there a Datastore which wraps a Backbone Model?

    That would be a simple way to solve this problem, on?

  • is it possible to include a WebixView in a webix.ui and then render it all once?

    Yep - http://webix.com/snippet/6339527e

    is it possible to build this nested hierarchy without requiring view ids?

    Yes, but it is not so flexible - http://webix.com/snippet/3682d1c4

  • You can sync any component with Backbone collection. Or use abstract DataCollection to do the same without any visualization. It will work against collections only, it will not work against separate model objects.

  • thanks, I actually have the models syncing in a collection, but I'm using plain Webix, not WebixView or webix_list(). I'll post some code after I've reviewed your links above.
    thanks,
    dave

  • Thanks for the snippets. However, it seems odd for the child view to have to reference it's parent.

    1) snippet: http://webix.com/snippet/6339527e
    The child needs to know the id of the parent: el: $$("data")

    2) snippet: http://webix.com/snippet/3682d1c4
    The child needs to know the structure of the parent: el: top.getChildViews()[1]

    ie: there are odd cyclic dependencies. For some components the app is constructed by separating the views into modules which are included in their parents, ie: parent -> children

    However, for WebixView components, the references are reversed: child -> parent.

    This smells bad to me.

    Having said all that, I'm perfectly happy using standard webix components with backbone, and not using WebixView or webix_list().

    ie: my views are separated into separate files, which are 'required' by a single webix.ui function which constructs the app. References are all parent -> child.

    Then, post rendering, the view ids are registered with Backbone Models and Collections.
    (actually I'm using Backfire, Backbone + Firebase).

    David

  • Hi,
    None of the above links are opening. Throws cannot find module .view.
    Please have a check.
    Regards,
    webix_learner

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!