diff --git a/bi/core.js b/bi/core.js index 4201d5d85..bc36f84a6 100644 --- a/bi/core.js +++ b/bi/core.js @@ -4673,6 +4673,9 @@ BI.Widget = BI.inherit(BI.OB, { widget = name; name = widget.getName(); } + if (BI.isKey(name)) { + name = name + ""; + } name = name || widget.getName() || BI.uniqueId("widget"); if (this._children[name]) { throw new Error("name has already been existed"); @@ -11557,9 +11560,8 @@ BI.Layout = BI.inherit(BI.Widget, { removeIndex = nameOrWidget; } if (removeIndex) { - this.options.items.splice(removeIndex, 1); + this._removeItemAt(removeIndex | 0); } - BI.Layout.superclass.removeWidget.apply(this, arguments); }, empty: function () { diff --git a/demo/js/config/widget.js b/demo/js/config/widget.js index 3d083e5a5..bb559fde4 100644 --- a/demo/js/config/widget.js +++ b/demo/js/config/widget.js @@ -9,6 +9,10 @@ Demo.WIDGET_CONFIG = [{ pId: 401, text: "bi.preview_table", value: "demo.preview_table" +}, { + pId: 401, + text: "bi.responsive_table", + value: "demo.responsive_table" }, { pId: 4, text: "bi.multi_select_combo", diff --git a/demo/js/widget/table/demo.responsive_table.js b/demo/js/widget/table/demo.responsive_table.js new file mode 100644 index 000000000..018a3092e --- /dev/null +++ b/demo/js/widget/table/demo.responsive_table.js @@ -0,0 +1,158 @@ +Demo.Func = BI.inherit(BI.Widget, { + props: { + baseCls: "demo-func" + }, + + render: function () { + var items = [[{ + text: "第一行第一列" + }, { + text: "第一行第一列" + }, { + text: "第一行第一列" + }], [{ + text: "第一行第一列" + }, { + text: "第一行第一列" + }, { + text: "第一行第一列" + }], [{ + text: "第三行第一列" + }, { + text: "第三行第二列" + }, { + text: "第三行第三列" + }], [{ + text: "第四行第一列" + }, { + text: "第四行第二列" + }, { + text: "第四行第三列" + }], [{ + text: "第五行第一列" + }, { + text: "第五行第二列" + }, { + text: "第五行第三列" + }], [{ + text: "第六行第一列" + }, { + text: "第六行第二列" + }, { + text: "第六行第三列" + }], [{ + text: "第七行第一列" + }, { + text: "第七行第二列" + }, { + text: "第七行第三列" + }], [{ + text: "第八行第一列" + }, { + text: "第八行第二列" + }, { + text: "第八行第三列" + }], [{ + text: "第九行第一列" + }, { + text: "第九行第二列" + }, { + text: "第九行第三列" + }], [{ + text: "第十行第一列" + }, { + text: "第十行第二列" + }, { + text: "第十行第三列" + }], [{ + text: "第十一行第一列" + }, { + text: "第十一行第二列" + }, { + text: "第十一行第三列" + }], [{ + text: "第十二行第一列" + }, { + text: "第十二行第二列" + }, { + text: "第十二行第三列" + }], [{ + text: "第十三行第一列" + }, { + text: "第十三行第二列" + }, { + text: "第十三行第三列" + }], [{ + text: "第十四行第一列" + }, { + text: "第十四行第二列" + }, { + text: "第十四行第三列" + }], [{ + text: "第十五行第一列" + }, { + text: "第十五行第二列" + }, { + text: "第十五行第三列" + }], [{ + text: "第十六行第一列" + }, { + text: "第十六行第二列" + }, { + text: "第十六行第三列" + }], [{ + text: "第十七行第一列" + }, { + text: "第十七行第二列" + }, { + text: "第十七行第三列" + }], [{ + text: "第十八行第一列" + }, { + text: "第十八行第二列" + }, { + text: "第十八行第三列" + }]]; + + + var header = [[{ + text: "表头1" + }, { + text: "表头2" + }, { + text: "表头3" + }]]; + + + var table1 = BI.createWidget({ + type: "bi.responsive_table", + isNeedMerge: true, + isNeedFreeze: true, + mergeCols: [0, 1], + columnSize: ["", "", ""], + items: items, + header: header + }); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: { + type: "bi.grid", + columns: 2, + rows: 2, + items: [{ + column: 0, + row: 0, + el: table1 + }] + }, + left: 10, + right: 10, + top: 10, + bottom: 10 + }] + }) + } +}); +BI.shortcut("demo.responsive_table", Demo.Func); \ No newline at end of file diff --git a/dist/core.js b/dist/core.js index ca58c5699..18bd9eefa 100644 --- a/dist/core.js +++ b/dist/core.js @@ -14585,6 +14585,9 @@ BI.Widget = BI.inherit(BI.OB, { widget = name; name = widget.getName(); } + if (BI.isKey(name)) { + name = name + ""; + } name = name || widget.getName() || BI.uniqueId("widget"); if (this._children[name]) { throw new Error("name has already been existed"); @@ -19690,9 +19693,8 @@ BI.Layout = BI.inherit(BI.Widget, { removeIndex = nameOrWidget; } if (removeIndex) { - this.options.items.splice(removeIndex, 1); + this._removeItemAt(removeIndex | 0); } - BI.Layout.superclass.removeWidget.apply(this, arguments); }, empty: function () { diff --git a/src/core/widget.js b/src/core/widget.js index f2bbcd8ec..2f4f3d390 100644 --- a/src/core/widget.js +++ b/src/core/widget.js @@ -249,6 +249,9 @@ BI.Widget = BI.inherit(BI.OB, { widget = name; name = widget.getName(); } + if (BI.isKey(name)) { + name = name + ""; + } name = name || widget.getName() || BI.uniqueId("widget"); if (this._children[name]) { throw new Error("name has already been existed"); diff --git a/src/core/wrapper/layout.js b/src/core/wrapper/layout.js index 477c5d7ce..4074b3fd7 100644 --- a/src/core/wrapper/layout.js +++ b/src/core/wrapper/layout.js @@ -361,9 +361,8 @@ BI.Layout = BI.inherit(BI.Widget, { removeIndex = nameOrWidget; } if (removeIndex) { - this.options.items.splice(removeIndex, 1); + this._removeItemAt(removeIndex | 0); } - BI.Layout.superclass.removeWidget.apply(this, arguments); }, empty: function () {