Proto UI layout used as Active Content In List

Hi,

I want to make a list where datas are initialized from $init / this.$ready.push (asynchronous loading)

And I want use Active Content in this list, where active element is a Layout view, not label view or checkbox view.

i don’t understand if is it possible to access data from Layout Active Content ?

If Active Content is checkbox view or label view, I got a solution.

http://webix.com/snippet/c2119e28

http://webix.com/snippet/b497e1a9

I do not face how to make it with a layout.

I guess maybe something that is not possible.

Have a nice day

Technically, only elements that have values can be represented as an activeContent. The layout doesn’t have any value, so you can only visualize it.

I can only suggest that the ui.proto object (based on the layout) that will have some value and corresponding methods (setValue, getValue) will work as you need.

Thanks for your help Listopad.

Have a nice day.

Sorry Listopad, I’m not sure to have understood your answer.

If I use ui.proto on layout, I got Uncaught TypeError: e[i] is not a function.

If I use ui.protoUI on webix.ui.layout, webix.DataValue (like http://webix.com/snippet/aaeb66b0), I got individual call to setValue (which is good).

But I don’t figure out how update correctly the view.

With this.addView, I got “ghost” data (+config as first element). But addView is not really what I want to do.

But with webix.ui, I don’t find a valid second argument…

Have you an idea ?

Have a nice day

PS : other questions,
how to define “auto width” ?
What is earlyInit ? I don’t find it in documentation.

I found a solution. Add this.reconstruct(); before addView :

http://webix.com/snippet/6318731d

I am unable to judge whether what I have done is correct or not…

Best regards

apparently, it’s a bad solution.

If I add a button, only last button have callback on click.

http://webix.com/snippet/072e4134

reconstruct must destroy handler definition.

Hi,

In practice, it is not a very good idea to use layouts as active elements. It is much better to use these elements separately: http://webix.com/snippet/b683ed80

Thank you Helga.

How do you do if you want display 2 labels ?

For an object like :

{id: 1, french_label: “bonjour !”, english_label: “Hello !” }

Or to use contextual content ?

My json is modified over the time (from asynchronous process calling list.data.add at creation, list.updateItem later)

{id: 1, status_workflow: “init”}

{id:1, status_workflow: “step1”, datas_from_step_1: [ “A”, “B”, “C”]}

{id:1, status_workflow: “final_step”, datas_from_step_1: [ “A”, “B”, “C”], datas_from_final_step: [ “DO”, “RE”, “MI” ] }

I have multiple documents with same evolutive structure.

Depending status_workflow, display must change dynamically.

It is why I want to use layout (with more datas, structure is more complex).

Have a nice day.

Philippe

Hi,

if you are going to use ActiveContent just for displaying data and don’t want any interactivity from them, you can use custom layout.

Here’s a simplified example: http://webix.com/snippet/fb11be11

It is vital to know that each ActiveContent item displays the corresponding data item. While rendering is performed within the template of active component (here:List).

Thanks for your help Helga !

I need interactivity from elements in lines.

I found a solution (certainly unclean).

I add dynamically new protoUI, add them dynamically in activeContent List (via common.masterUI._settings.activeContent[newAC]), binding them (via common[ newAc ] = common.masterUI._bind_active_content( newAC ):wink: and later refresh common.masterUI.

I hope to do a snipplet in few days.

It is probably a bad solution but I don’t have many lines to process.

Best regards

Philippe