Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit 4e2a327

Browse files
committed
Fixes to GridView & mxii.dom.create
Implemented Mxui.dom.create Corrected deprecation within the GridView.
1 parent 3fed57e commit 4e2a327

File tree

3 files changed

+55
-52
lines changed

3 files changed

+55
-52
lines changed

src/TreeView/widget/Commons.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,19 @@ dojo.setObject("TreeView.widget.Commons", (function() {
4949
* @return {[type]} node [description]
5050
*/
5151
function renderLabel(name, close, data) {
52-
var n = mxui.dom.span(
52+
var n = mxui.dom.create(
53+
"span",
5354
{ 'class' : 'gv_label' },
54-
mxui.dom.span(
55+
mxui.dom.create(
56+
"span",
5557
{ 'class' : 'gv_label_name' },
5658
name ? name : ""
5759
)
5860
);
5961

6062
if (close)
61-
dojo.place(mxui.dom.span(
63+
dojo.place(mxui.dom.create(
64+
"span",
6265
{ 'class' : 'gv_label_close' },
6366
'x'
6467
), n);
@@ -567,7 +570,7 @@ dojo.declare("TreeView.widget.Checkbox", null, {
567570
constructor : function(args, domNode) {
568571
dojo.mixin(this, args);
569572

570-
this.checkbox = mendix.dom.input({
573+
this.checkbox = mxui.dom.create("input", {
571574
type : "checkbox"
572575
});
573576

@@ -699,7 +702,7 @@ dojo.declare("TreeView.widget.Colrenderer", null, {
699702

700703
createDefaultImage : function(parentNode) {
701704
if (this.columnimage) {
702-
dojo.place(mxui.dom.img({
705+
dojo.place(mxui.dom.create('img', {
703706
//'class' : 'gg_img ' + this.columnclazz,
704707
//'style' : this.columnstyle,
705708
'src' : this.columnimage
@@ -853,7 +856,7 @@ dojo.declare("TreeView.widget.Colrenderer", null, {
853856
if (!url)
854857
url = this.columnimage;
855858

856-
domNode.appendChild(mxui.dom.img({
859+
domNode.appendChild(mxui.dom.create("img",{
857860
//'class' : 'gg_img ' + this.columnclazz,
858861
//'style' : this.columnstyle,
859862
'src' : url
@@ -868,7 +871,7 @@ dojo.declare("TreeView.widget.Colrenderer", null, {
868871

869872
var fileid = TreeView.widget.Commons.getObjectAttr(record.data(), this.columnattr == '' ? 'FileID' : this.columnattr);
870873
var cd = TreeView.widget.Commons.getObjectAttr(record.data(), this.columnattr.replace(/FileID/,'') + 'changedDate');
871-
domNode.appendChild(mxui.dom.img({
874+
domNode.appendChild(mxui.dom.create("img",{
872875
//'class' : 'gg_img ' + this.columnclazz,
873876
//'style' : this.columnstyle,
874877
'src' : 'file?thumb=true&target=internal&fileID=' + fileid + '&changedDate='+cd
@@ -880,7 +883,7 @@ dojo.declare("TreeView.widget.Colrenderer", null, {
880883
var fileid = TreeView.widget.Commons.getObjectAttr(record.data(), this.columnattr == '' ? 'FileID' : this.columnattr);
881884
var cd = TreeView.widget.Commons.getObjectAttr(record.data(), this.columnattr.replace(/FileID/,'') + 'changedDate');
882885

883-
domNode.appendChild(mxui.dom.img({
886+
domNode.appendChild(mxui.dom.create("img",{
884887
//'class' : 'gg_img ' + this.columnclazz,
885888
//'style' : this.columnstyle,
886889
'src' : 'file?thumb=false&target=internal&fileID=' + fileid + '&changedDate='+cd
@@ -1328,11 +1331,11 @@ dojo.declare("TreeView.widget.SearchControl", null, {
13281331
},
13291332

13301333
setupLayout : function() {
1331-
this.domNode = mxui.dom.div({
1334+
this.domNode = mxui.dom.create("div",{
13321335
'class' : 'gv_searchBar'
13331336
});
13341337

1335-
this.labelContainer = mxui.dom.div({ 'class' : 'gv_searchLabelContainer'});
1338+
this.labelContainer = mxui.dom.create("div",{ 'class' : 'gv_searchLabelContainer'});
13361339
dojo.place(this.labelContainer, this.domNode);
13371340
},
13381341

src/TreeView/widget/GridView.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ dojo.declare("TreeView.widget.Colhead", null, {
2626

2727
//sort caption?
2828
if (this.data.colheadcaption)
29-
dojo.place(mendix.dom.span({'class' : 'gv_sort_caption'}, this.data.colheadcaption), this.domNode);
29+
dojo.place(mxui.dom.create("span", {'class' : 'gv_sort_caption'}, this.data.colheadcaption), this.domNode);
3030

3131
//show sort arrow?
3232
if (this.getSortAttr())
33-
dojo.place(mendix.dom.span({'class' : 'gv_sort_arrow'}), this.domNode);
33+
dojo.place(mxui.dom.create("span", {'class' : 'gv_sort_arrow'}), this.domNode);
3434

3535

3636
dojo.place(this.domNode, this.grid.headerRow);
@@ -132,29 +132,29 @@ dojo.declare("TreeView.widget.Record", null, {
132132
},
133133

134134
setup : function(tablenode) {
135-
this.domNode = mendix.dom[this.grid.showasdiv ? "div" : "tr"]({ 'class' : 'gv_row gv_row_' + tablenode.childElementCount });
135+
this.domNode = mxui.dom[this.grid.showasdiv ? "div" : "tr"]({ 'class' : 'gv_row gv_row_' + tablenode.childElementCount });
136136

137137
if (this.grid.showasdiv && this.grid.colheads.length > 0 && this.grid.colheads[0].getWidth())
138138
dojo.style(this.domNode, 'width', this.grid.colheads[0].getWidth());
139139

140140
mxui.dom.data(this.domNode, "data", this);
141141

142-
this.checkbox = mendix.dom.input( {
142+
this.checkbox = mxui.dom.create("input", {
143143
'type' : 'checkbox',
144144
'class' : 'gv_multiselect_checkbox',
145145
'style' : this.grid.allowmultiselect === true ? '' : 'display:none'
146146
});
147147

148-
dojo.place(mendix.dom[this.grid.showasdiv ? "div" : "td"]({
148+
dojo.place(mxui.dom[this.grid.showasdiv ? "div" : "td"]({
149149
'class' : 'gv_cell gv_cell_0 gv_cell_multiselect'
150150
}, this.checkbox), this.domNode);
151151

152152
//create td's
153153
for (var i = 0; i < this.grid.colheads.length; i++) {
154-
var cell = mendix.dom[this.grid.showasdiv ? "div" : "td"]({
154+
var cell = mxui.dom[this.grid.showasdiv ? "div" : "td"]({
155155
'class' : 'gv_cell gv_cell_' + this.grid.colheads[i].data.colheadname + ' gv_cell_' + i
156156
});
157-
var colwrapper = mendix.dom.div({ 'class' : 'gv_cell_wrapper'});
157+
var colwrapper = mxui.dom.create("div", { 'class' : 'gv_cell_wrapper'});
158158

159159
dojo.place(colwrapper, cell);
160160
dojo.place(cell, this.domNode);
@@ -165,11 +165,11 @@ dojo.declare("TreeView.widget.Record", null, {
165165
if (1 * col.columnindex >= this.grid.colheads.length)
166166
this.configError("Column index out of bounds: " + col.columnindex);
167167

168-
var span = mxui.dom.span({'class' : 'gv_column gv_column_' + i});
168+
var span = mxui.dom.create("span", {'class' : 'gv_column gv_column_' + i});
169169
this._colNodes.push(span);
170170

171171
//wrapper node
172-
var cw = mxui.dom.span({ 'class' : 'gv_column_wrapper' }, span);
172+
var cw = mxui.dom.create("span", { 'class' : 'gv_column_wrapper' }, span);
173173
dojo.place(cw, this.domNode.childNodes[1 + 1 * col.columnindex].children[0]);
174174

175175
col.setupNode(span);
@@ -646,36 +646,36 @@ mxui.widget.declare("TreeView.widget.GridView", {
646646
if (this.count > this.pagesize || this.curpage > 0) {
647647
//show prev btn?
648648
if (this.curpage > 0)
649-
dojo.place(mendix.dom.a({ 'class' : 'gv_btn_prev'}, "<"), this.pagingNode);
649+
dojo.place(mxui.dom.create("a", { 'class' : 'gv_btn_prev'}, "<"), this.pagingNode);
650650

651651
//page 1
652-
dojo.place(mendix.dom.a({ 'class' : 'gv_btn_page ' + (0 === this.curpage ? 'gv_btn_page_active' : '')}, "1"), this.pagingNode);
652+
dojo.place(mxui.dom.create("a", { 'class' : 'gv_btn_page ' + (0 === this.curpage ? 'gv_btn_page_active' : '')}, "1"), this.pagingNode);
653653

654654
//paging skipper?
655655
if (this.curpage > PAGERSIZE)
656-
dojo.place(mendix.dom.a({ 'class' : 'gv_btn_paging_spacer'}, ".."), this.pagingNode);
656+
dojo.place(mxui.dom.create("a", { 'class' : 'gv_btn_paging_spacer'}, ".."), this.pagingNode);
657657

658658
for(var i = Math.max(this.curpage - PAGERSIZE + 1, 1); i < Math.min(this.curpage + PAGERSIZE , lastpage); i++)
659-
dojo.place(mendix.dom.a({ 'class' : 'gv_btn_page ' + (i === this.curpage ? 'gv_btn_page_active' : '')}, "" + (i + 1)), this.pagingNode);
659+
dojo.place(mxui.dom.create("a", { 'class' : 'gv_btn_page ' + (i === this.curpage ? 'gv_btn_page_active' : '')}, "" + (i + 1)), this.pagingNode);
660660

661661
//paging skipper?
662662
if (this.curpage < lastpage - PAGERSIZE)
663-
dojo.place(mendix.dom.a({ 'class' : 'gv_btn_paging_spacer'}, ".."), this.pagingNode);
663+
dojo.place(mxui.dom.create("a", { 'class' : 'gv_btn_paging_spacer'}, ".."), this.pagingNode);
664664

665665
//last page
666-
dojo.place(mendix.dom.a({ 'class' : 'gv_btn_page ' + (lastpage === this.curpage ? 'gv_btn_page_active' : '')}, "" + (lastpage + 1)), this.pagingNode);
666+
dojo.place(mxui.dom.create("a", { 'class' : 'gv_btn_page ' + (lastpage === this.curpage ? 'gv_btn_page_active' : '')}, "" + (lastpage + 1)), this.pagingNode);
667667

668668
//show next btn?
669669
if (this.curpage < lastpage)
670-
dojo.place(mendix.dom.a({ 'class' : 'gv_btn_next'}, ">"), this.pagingNode);
670+
dojo.place(mxui.dom.create("a", { 'class' : 'gv_btn_next'}, ">"), this.pagingNode);
671671

672672
}
673673

674674
if (this.count === 0) {
675-
dojo.place(mendix.dom.span({'class' : 'gv_empty_message'}, this.emptymessage), this.pagingNode);
675+
dojo.place(mxui.dom.create("span", {'class' : 'gv_empty_message'}, this.emptymessage), this.pagingNode);
676676
}
677677
else if (this.showtotals)
678-
dojo.place(mendix.dom.span({'class' : 'gv_paging_totals'},
678+
dojo.place(mxui.dom.create("span", {'class' : 'gv_paging_totals'},
679679
(this.itemcountmessage || (this._multiSelection.length > 1 ? "{1} of {0} item(s) selected." : "{0} item(s) in total")).replace("{0}", this.count).replace("{1}", this._multiSelection.length)
680680
), this.pagingNode);
681681
},
@@ -897,7 +897,7 @@ mxui.widget.declare("TreeView.widget.GridView", {
897897
node = node.parentNode;
898898

899899
//assuming dataset: { owner: record, guid : guid, dataset: this.columneditdataset, colindex: this.colindex }
900-
var data = mendix.dom.data(node, "data");
900+
var data = mxui.dom.data(node, "data");
901901
var record = data.owner;
902902
var guid = data.guid;
903903
var dataset = this.dataset[data.dataset];
@@ -1170,23 +1170,23 @@ mxui.widget.declare("TreeView.widget.GridView", {
11701170
if (this.showasdiv)
11711171
dojo.addClass(this.domNode, 'gv_floating_grid');
11721172

1173-
this.headerNode = mendix.dom.div({'class' : 'gv_header'});
1173+
this.headerNode = mxui.dom.create("div", {'class' : 'gv_header'});
11741174

1175-
this.gridNode = mendix.dom[this.showasdiv ? "div" : "table"]({'class': 'gv_table'});
1175+
this.gridNode = mxui.dom[this.showasdiv ? "div" : "table"]({'class': 'gv_table'});
11761176

1177-
this.headerRow = mendix.dom[this.showasdiv ? "div" : "tr"]({'class':'gv_headrow'}, mendix.dom[this.showasdiv ? "div" : "th"]({ 'class' : 'gv_multiselect_column_head gv_th gv_th_0'}));
1178-
var header = mendix.dom[this.showasdiv ? "div" : "thead"]({'class':'gv_gridhead'}, this.headerRow);
1177+
this.headerRow = mxui.dom[this.showasdiv ? "div" : "tr"]({'class':'gv_headrow'}, mxui.dom[this.showasdiv ? "div" : "th"]({ 'class' : 'gv_multiselect_column_head gv_th gv_th_0'}));
1178+
var header = mxui.dom[this.showasdiv ? "div" : "thead"]({'class':'gv_gridhead'}, this.headerRow);
11791179

11801180
dojo.addClass(this.domNode, this.colheaderenabled ? 'gv_columnheaders' : 'gv_nocolumnheaders');
11811181
dojo.addClass(this.domNode, this.allowmultiselect ? 'gv_multiselect_enabled' : 'gv_multiselect_disabled');
11821182

11831183
dojo.place(header, this.gridNode, 'first');
11841184

1185-
this.footerNode = mendix.dom.div({'class' : 'gv_footer'});
1186-
this.pagingNode = mendix.dom.div({'class' : 'gv_paging'});
1185+
this.footerNode = mxui.dom.create("div", {'class' : 'gv_footer'});
1186+
this.pagingNode = mxui.dom.create("div", {'class' : 'gv_paging'});
11871187
dojo.place(this.pagingNode, this.footerNode);
11881188

1189-
this.searchbarNode = mendix.dom.div({'class' : 'gv_searchnode'});
1189+
this.searchbarNode = mxui.dom.create("div", {'class' : 'gv_searchnode'});
11901190
dojo.place(this.searchbarNode, this.headerNode);
11911191

11921192
dojo.place(this.headerNode, this.domNode);

src/TreeView/widget/TreeView.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -463,14 +463,14 @@ dojo.declare("TreeView.widget.RenderEdge", null, {
463463
this.tree = this.parent.tree;
464464
this.children = [];
465465

466-
var childNode = this.childNode = mxui.dom.ul({'class' : 'gg_assoc_children gg_assoc_' + type.assoc.replace(".","_")});
467-
var wrapperNode = this.domNode = mxui.dom.li({'class' : 'gg_assoc_wrapper ' + type.assocclazz});
466+
var childNode = this.childNode = mxui.dom.create("ul", {'class' : 'gg_assoc_children gg_assoc_' + type.assoc.replace(".","_")});
467+
var wrapperNode = this.domNode = mxui.dom.create("li", {'class' : 'gg_assoc_wrapper ' + type.assocclazz});
468468

469469
this.visible = type.showassocname;
470470
if (this.visible) {
471-
var fold = this.foldNode = mxui.dom.span({});
472-
var caption = mxui.dom.span({'class' : 'gg_assoc_title gg_assoc_' + type.assoc.replace(".","_")}, type.assoccaption);
473-
var div = new mxui.dom.div({'class' : 'gg_row', 'style' : type.assocstyle }, fold, caption);
471+
var fold = this.foldNode = mxui.dom.create("span",{});
472+
var caption = mxui.dom.create("span", {'class' : 'gg_assoc_title gg_assoc_' + type.assoc.replace(".","_")}, type.assoccaption);
473+
var div = new mxui.dom.create("div", {'class' : 'gg_row', 'style' : type.assocstyle }, fold, caption);
474474
dojo.place(div, wrapperNode);
475475

476476
dojo.addClass(childNode, 'gg_assoc_wrapped');
@@ -635,11 +635,11 @@ dojo.declare("TreeView.widget.RenderNode", null, {
635635

636636
this.canHazChildren = this.graphNode.getChildTypes().length > 0;
637637

638-
this.foldNode = mxui.dom.span({'class': 'gg_nodefold gg_fold ' + (this.canHazChildren ? 'gg_folded' : 'gg_nofold')});
639-
this.dataNode = mxui.dom.span({'class': 'gg_data', 'style' : this.graphNode.xsettings.entitystyle });
640-
this.childNode = mxui.dom.ul({'class': 'gg_children'});
641-
this.rowNode = mxui.dom.div({'class' : 'gg_row' }, this.foldNode, this.dataNode);
642-
this.domNode = mxui.dom.li({'class':'gg_node ' + this.graphNode.xsettings.entityclazz }, this.rowNode, this.childNode);
638+
this.foldNode = mxui.dom.create("span", {'class': 'gg_nodefold gg_fold ' + (this.canHazChildren ? 'gg_folded' : 'gg_nofold')});
639+
this.dataNode = mxui.dom.create("span", {'class': 'gg_data', 'style' : this.graphNode.xsettings.entitystyle });
640+
this.childNode = mxui.dom.create("ul", {'class': 'gg_children'});
641+
this.rowNode = mxui.dom.create("div", {'class' : 'gg_row' }, this.foldNode, this.dataNode);
642+
this.domNode = mxui.dom.create("li", {'class':'gg_node ' + this.graphNode.xsettings.entityclazz }, this.rowNode, this.childNode);
643643

644644
mxui.dom.data(this.domNode, "ggdata", this);
645645

@@ -797,9 +797,9 @@ dojo.declare("TreeView.widget.RenderNode", null, {
797797

798798
for(var i = 0, col= null; col = this.tree.columns[i]; i++) {
799799
if (col.appliesTo(this)) {
800-
var span = mxui.dom.span({'class' : 'gg_column gg_column_' + i});
800+
var span = mxui.dom.create("span", {'class' : 'gg_column gg_column_' + i});
801801
this._colNodes.push(span);
802-
this.dataNode.appendChild(mxui.dom.span({ 'class' : 'gg_column_wrapper' }, span)); //wrapper column for hovers and such
802+
this.dataNode.appendChild(mxui.dom.create("span", { 'class' : 'gg_column_wrapper' }, span)); //wrapper column for hovers and such
803803

804804
col.setupNode(span);
805805
}
@@ -1332,7 +1332,7 @@ mxui.widget.declare("TreeView.widget.TreeView", {
13321332

13331333
startDrag : function(target, e) {
13341334
//tmp node for drag an drop operations
1335-
this.dnd.tmpnode = mxui.dom.li({'class' : 'gg_node gg_anchor'}, mxui.dom.div({'class' : 'gg_anchor_inner'}));
1335+
this.dnd.tmpnode = mxui.dom.create("li", {'class' : 'gg_node gg_anchor'}, mxui.dom.create("div", {'class' : 'gg_anchor_inner'}));
13361336

13371337
var current = this.dnd.current = this._getRenderNodeForNode(target);
13381338
this.setSelection(current);
@@ -1341,7 +1341,7 @@ mxui.widget.declare("TreeView.widget.TreeView", {
13411341
if (current.isEdge || current.isRoot || !current.type.allowdnd)
13421342
return false;
13431343

1344-
var avatar = this.dnd.avatar = mxui.dom.div({'class' : 'gg_avatar'}, dojo.clone(current.rowNode)); //TODO: make beter avatar
1344+
var avatar = this.dnd.avatar = mxui.dom.create("div", {'class' : 'gg_avatar'}, dojo.clone(current.rowNode)); //TODO: make beter avatar
13451345

13461346
//hooray, we can start thedrag
13471347
// console.log("start drag");
@@ -1905,9 +1905,9 @@ mxui.widget.declare("TreeView.widget.TreeView", {
19051905

19061906
setupLayout : function() {
19071907
dojo.addClass(this.domNode, 'gg_tree');
1908-
this.headerNode = mxui.dom.div({'class' : 'gg_header'});
1908+
this.headerNode = mxui.dom.create("div", {'class' : 'gg_header'});
19091909

1910-
this.treeNode = mxui.dom.ul({'class': 'gg_children gg_root_wrapper'});
1910+
this.treeNode = mxui.dom.create("ul", {'class': 'gg_children gg_root_wrapper'});
19111911
if (this.hiderootnode)
19121912
dojo.addClass(this.treeNode, 'gg_hiddenroot');
19131913

0 commit comments

Comments
 (0)