Hi,
Whats the best way to attach a dataview to a layout Element. I want to be able to drag and drop between them also. I see there is an undocumented method attachDataView() but I could not get this to work (throwing undefined id error).
so I can use
[code]myLayout.cells(“b”).attachHTMLString(‘
’);
data1 = new dhtmlXDataView({
container:“data_container1”,
type:{
template:“
#Map #”,
height:80,
width:80
},
drag:true
});
myLayout.cells("c").attachHTMLString('<div id="data_container2" ></div>');
data2 = new dhtmlXDataView({
container:"data_container2",
type:{
template:"<span class='dhx_light'>#Map#</span>",
height:80,
width:80
},
drag:true
});[/code]
But just wondered if .attachDataView is available …
Thanks,
Dave
Yep, dataview can be attached similar to other components
var data1 = myLayout.cells("b").attachDataView({
container:"data_container1",
type:{
template:"<span class='dhx_light'>#Map#</span>",
height:80,
width:80
},
drag:true
});
basically, attachDataView accepts the same configuration object as constructor of datavew and creates dataview in the cell of layout|window|tabbar|accordion.
fpinta
January 13, 2011, 2:38pm
#3
Sorry but I don’t have the function attachDataView and I have the latest version.
By.
Are you using full suite or separate js files for each component?
In second case, be sure that dhtmlxcommon.js was included before DataView, and was included only once.
nexar
January 14, 2011, 10:11am
#5
Hi I would like to joing this discussion because I want to do similar thing. I have 2 questions:
In following code where does ‘data_container1’ come from?
var data1 = myLayout.cells("b").attachDataView({
container:"data_container1",
type:{
template:"<span class='dhx_light'>#Map#</span>",
height:80,
width:80
},
drag:true
});
If I want to make the dataview with paging then what is the code I need?
Thanks for your help
(a)
When you are using attachDataView - you need not use “container” property at all. The cell of layout will be used as container automatically
(b)
docs.dhtmlx.com/doku.php?id=dhtm … iew:paging
container:"paging_here",
it must reffer to some other html container , which you can attach to different cell of layout or include in the tabbar or statusbar of the cell.
nexar
January 14, 2011, 11:37am
#7
Thanks Stanislav. I thought you didn’t need a container if you were attaching to a layout.
So for the paging part can I create a cell ‘c’ and pass that as the container as per the following code?:
var data1 = myLayout.cells("b").attachDataView({
type:{
template:"<span class='dhx_light'>#Map#</span>",
height:80,
width:80
},
pager:{
container:myLayout.cells("c"),
size:20,
group:8
}
});
fpinta
January 14, 2011, 12:28pm
#8
OK… it works!!! I wrong the order of .js inclusion.
Thanks.
Nexar,
try to attach pager to the myLayout.cells(“c”).firstChild
var data1 = myLayout.cells("b").attachDataView({
type:{
template:"<span class='dhx_light'>#Map#</span>",
height:80,
width:80
},
pager:{
container:myLayout.cells("c").firstChild,
size:20,
group:8
}
});
nexar
January 14, 2011, 1:42pm
#10
Thanks Alexandra, I will try that a bit later and let you know how it went.