Can Datatables detect click and drag highlighted cells and show a sum (like excel)
Can Datatables detect click and drag highlighted cells and show a sum (like excel)
monkeyboy
Posts: 60Questions: 19Answers: 0
Allan,
I have a request from my beta test users to be able to highlight a cell range of numbers, and have an element on the page show the sum of the numbers. (similar to how excel will show sum and average and cell count in the lower right hand footer)
Any suggestions on how to detect the "highlight"/"click-drag" area defined by the mouse and then fetch the appropriate cell
addresses to be able to apply a function?
Thanks!
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
This might be an ideal use case for AutoFill's plug-in abilities (I'm excited about that, as it doesn't get used often!).
If you take a look at this example - then click and drag the drag handle over multiple rows and columns (that's important) AutoFill will give you a list of options for the action to complete. You can add your own (indeed the built in options are just pre-included plug-ins themselves).
Details about custom plug-ins for AutoFill can be found here. Rather than modifying the data in the table you'd just use that data to fill in the sum.
Regards,
Allan