mirror of
https://github.com/lxsang/antos-frontend.git
synced 2025-02-22 01:42:47 +01:00
allow enable/disable grid resize feature
This commit is contained in:
parent
45d425d5db
commit
cc4081f9a0
@ -582,6 +582,7 @@ namespace OS {
|
|||||||
};
|
};
|
||||||
const grid = this.refs.gridview as GridViewTag;
|
const grid = this.refs.gridview as GridViewTag;
|
||||||
const list = this.refs.listview as ListViewTag;
|
const list = this.refs.listview as ListViewTag;
|
||||||
|
grid.resizable = true;
|
||||||
grid.header = this._header;
|
grid.header = this._header;
|
||||||
tree.dragndrop = true;
|
tree.dragndrop = true;
|
||||||
list.dragndrop = true;
|
list.dragndrop = true;
|
||||||
|
@ -443,6 +443,7 @@ namespace OS {
|
|||||||
this._selectedRows = [];
|
this._selectedRows = [];
|
||||||
this._selectedRow = undefined;
|
this._selectedRow = undefined;
|
||||||
this._rows = [];
|
this._rows = [];
|
||||||
|
this.resizable = false;
|
||||||
this._oncellselect = this._onrowselect = this._oncelldbclick = (
|
this._oncellselect = this._onrowselect = this._oncelldbclick = (
|
||||||
e: TagEventType<CellEventData>
|
e: TagEventType<CellEventData>
|
||||||
): void => {};
|
): void => {};
|
||||||
@ -539,22 +540,24 @@ namespace OS {
|
|||||||
element.data = item;
|
element.data = item;
|
||||||
item.domel = element;
|
item.domel = element;
|
||||||
i++;
|
i++;
|
||||||
if (i != v.length) {
|
if (this.resizable) {
|
||||||
const rz = $(`<afx-resizer>`).appendTo(
|
if (i != v.length) {
|
||||||
this.refs.header
|
const rz = $(`<afx-resizer>`).appendTo(
|
||||||
)[0] as ResizerTag;
|
this.refs.header
|
||||||
$(rz).css("width", "3px");
|
)[0] as ResizerTag;
|
||||||
let next_item = undefined;
|
$(rz).css("width", "3px");
|
||||||
if (i < v.length) {
|
let next_item = undefined;
|
||||||
next_item = v[i];
|
if (i < v.length) {
|
||||||
}
|
next_item = v[i];
|
||||||
rz.onelresize = (e) => {
|
|
||||||
item.width = e.data.w + 3;
|
|
||||||
if (next_item) {
|
|
||||||
delete next_item.width;
|
|
||||||
}
|
}
|
||||||
};
|
rz.onelresize = (e) => {
|
||||||
rz.uify(this.observable);
|
item.width = e.data.w + 3;
|
||||||
|
if (next_item) {
|
||||||
|
delete next_item.width;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
rz.uify(this.observable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.calibrate();
|
this.calibrate();
|
||||||
@ -623,6 +626,20 @@ namespace OS {
|
|||||||
return this.hasattr("multiselect");
|
return this.hasattr("multiselect");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set and Get the resizable attribute
|
||||||
|
*
|
||||||
|
* This allows to enable/disable column resize feature
|
||||||
|
*
|
||||||
|
* @memberof GridViewTag
|
||||||
|
*/
|
||||||
|
set resizable(v: boolean) {
|
||||||
|
this.attsw(v, "resizable");
|
||||||
|
}
|
||||||
|
get resizable(): boolean {
|
||||||
|
return this.hasattr("resizable");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a grid rows
|
* Delete a grid rows
|
||||||
*
|
*
|
||||||
@ -867,7 +884,7 @@ namespace OS {
|
|||||||
template += `${v}px `;
|
template += `${v}px `;
|
||||||
i++;
|
i++;
|
||||||
template_header += `${v}px `;
|
template_header += `${v}px `;
|
||||||
if (i < colssize.length) {
|
if (i < colssize.length && this.resizable) {
|
||||||
template_header += "3px ";
|
template_header += "3px ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,8 @@ namespace OS {
|
|||||||
*
|
*
|
||||||
* Getter:
|
* Getter:
|
||||||
* - get the resize event callback
|
* - get the resize event callback
|
||||||
* @memberof GridViewTag
|
*
|
||||||
|
* @memberof ResizerTag
|
||||||
*/
|
*/
|
||||||
set onelresize(v: TagEventCallback<any>) {
|
set onelresize(v: TagEventCallback<any>) {
|
||||||
this._onresize = v;
|
this._onresize = v;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user