Celebio/SlickGrid

getDataItemValueForColumn performance; copy column headers; row selection model compatibility

ronmichael opened this issue · 3 comments

For the life of me I couldn't figure out how to make a pull request to a fork but I have some useful updates for cellexternalcopymanager.js. I couldn't figure out a better way to pass this on so here is a link to my version of the file and notes on what changed:

https://github.com/ronmichael/SlickGrid/blob/master/plugins/slick.cellexternalcopymanager.js

  • updated getDataItemValueForColumn to use the column formatter if it has one before using the editor. This SIGNIFICANTLY reduces the amount of time it took to build the copy for large datasets with complex editors
  • added an includeHeaderWhenCopying option that'll include the column headers in the copied text if set to true. Makes the pasted text more usable in some cases.
  • changed how the copied text is built so that it works when using a row selection model. Also fixed the minor issue that the copied output was missing the CR/LF on the last row.

Nice !
How exactly includeHeaderWhenCopying works?

Just set the includeHeaderWhenCopying option to true when you initialize the plugin. Then it'll take the name property from each column (which is usually what appears in your header) and put that as the first row of the text that's copied to the clipboard.

I added your description in the code. Thank you for your contribution.