Posted 28 October 2020, 4:12 pm EST
Is there a way to edit one cell at a time with the DataViewJS?
Thanks
John
Forums Home / Spread / DataViewsJS
Posted by: johngiblin on 28 October 2020, 4:12 pm EST
Posted 28 October 2020, 4:12 pm EST
Is there a way to edit one cell at a time with the DataViewJS?
Thanks
John
Posted 29 October 2020, 10:34 am EST
Hi Jhon,
You may use editMode to edit a single cell at a time. Please refer to the following code snippet and the attached sample that demonstrates the same.
let dv = new GC.DataViews.DataView(
"#grid",
data,
columns,
new GC.DataViews.GridLayout({
allowColumnResize: true,
allowColumnReorder: false,
showRowHeader: false,
editUnit: "cell",
selectionUnit: "cell",
allowEditing: true,
editMode: "inline"
})
);
sample: https://codesandbox.io/s/dvjs-sample-forked-9l154?file=/src/index.js:491-778
References:
Editing Demo: https://www.grapecity.com/dataviewsjs/demos/Features/Editing/EditorMode#
Regards
Avinash
Posted 29 October 2020, 12:20 pm EST
That is exactly what I was looking for.
I see in the onEditing what the row is being editted, but I do not see how to get the column. Is there a way to get the column as well
Posted 2 November 2020, 10:09 am EST
Hi,
You may use getSelections method for getting the column. Please refer to the following code snippet and let us know if you face any issues.
dv.editing.addHandler((args) => {
console.log(dv.getSelections()[0].columns[0]);
});
API Refrences:
getSelections: https://www.grapecity.com/dataviewsjs/api/classes/core.dataview.html#getselections
Regards
Avinash
Posted 2 November 2020, 11:22 am EST
Thank you Avinash.
Posted 9 December 2020, 4:56 pm EST
So the dv.getSelections()[0].columns[0] was able to get me the column, but if I use the tab, it keeps the 1st row selected and this method will return me the original cell
I need to be able to determine the column that is being editted when tabbed into
Posted 10 December 2020, 3:44 am EST
Hi John,
We are able to replicate the issue at our end hence we have forwarded it to the concerned team for further investigation. We will update you regarding this as soon as we get any information. The internal ID for this issue will be JSVIEW-698.
Regards
Avinash
Posted 10 December 2020, 11:14 am EST
I was able to add a focuschange handler
private focusChangedDataView(sender: any, args: any): void { this.currentColumn = args.column; // console.log(args); }
Posted 16 December 2020, 9:15 am EST
Hi John,
The Dev team is curious about your use case. Could you please provide a use case. the team just wants to know what kind of functionality you are trying to achieve by getting the currently editing Cell.
Regards
Avinash
Posted 16 December 2020, 9:18 am EST
Hi John,
We are glad to know the issue has been resolved at our end. Please feel free to contact me if you have any further queries. Further, we will update you regarding the SelectionChanged with tab issue here.
Regards
Avinash