mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-11-08 14:08:22 +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 list = this.refs.listview as ListViewTag;
|
||||
grid.resizable = true;
|
||||
grid.header = this._header;
|
||||
tree.dragndrop = true;
|
||||
list.dragndrop = true;
|
||||
|
@ -443,6 +443,7 @@ namespace OS {
|
||||
this._selectedRows = [];
|
||||
this._selectedRow = undefined;
|
||||
this._rows = [];
|
||||
this.resizable = false;
|
||||
this._oncellselect = this._onrowselect = this._oncelldbclick = (
|
||||
e: TagEventType<CellEventData>
|
||||
): void => {};
|
||||
@ -539,22 +540,24 @@ namespace OS {
|
||||
element.data = item;
|
||||
item.domel = element;
|
||||
i++;
|
||||
if (i != v.length) {
|
||||
const rz = $(`<afx-resizer>`).appendTo(
|
||||
this.refs.header
|
||||
)[0] as ResizerTag;
|
||||
$(rz).css("width", "3px");
|
||||
let next_item = undefined;
|
||||
if (i < v.length) {
|
||||
next_item = v[i];
|
||||
}
|
||||
rz.onelresize = (e) => {
|
||||
item.width = e.data.w + 3;
|
||||
if (next_item) {
|
||||
delete next_item.width;
|
||||
if (this.resizable) {
|
||||
if (i != v.length) {
|
||||
const rz = $(`<afx-resizer>`).appendTo(
|
||||
this.refs.header
|
||||
)[0] as ResizerTag;
|
||||
$(rz).css("width", "3px");
|
||||
let next_item = undefined;
|
||||
if (i < v.length) {
|
||||
next_item = v[i];
|
||||
}
|
||||
};
|
||||
rz.uify(this.observable);
|
||||
rz.onelresize = (e) => {
|
||||
item.width = e.data.w + 3;
|
||||
if (next_item) {
|
||||
delete next_item.width;
|
||||
}
|
||||
};
|
||||
rz.uify(this.observable);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.calibrate();
|
||||
@ -623,6 +626,20 @@ namespace OS {
|
||||
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
|
||||
*
|
||||
@ -867,7 +884,7 @@ namespace OS {
|
||||
template += `${v}px `;
|
||||
i++;
|
||||
template_header += `${v}px `;
|
||||
if (i < colssize.length) {
|
||||
if (i < colssize.length && this.resizable) {
|
||||
template_header += "3px ";
|
||||
}
|
||||
}
|
||||
|
@ -139,7 +139,8 @@ namespace OS {
|
||||
*
|
||||
* Getter:
|
||||
* - get the resize event callback
|
||||
* @memberof GridViewTag
|
||||
*
|
||||
* @memberof ResizerTag
|
||||
*/
|
||||
set onelresize(v: TagEventCallback<any>) {
|
||||
this._onresize = v;
|
||||
|
Loading…
Reference in New Issue
Block a user