3

I'm trying to figure out how to add "batch editing", i.e. editing multiple cells at the same time, to SlickGrid. I didn't see any examples on the SlickGrid examples page. I think there's three good options for the UI I'd like to implement (in order of preference):

  1. An Excel-like "Fill Down" feature. I haven't seen this in almost all the grid/spreadsheet-like widgets I've found, except in jquery-handsontable, where it's called "Drag-down". Some intelligence during the paste, where numbers can be auto-incremented for each cell, would be totally awesome.

  2. Copying a single cell, then selecting a range and pasting that single cell into the range. This should then paste that single cell's contents into every cell in the selected range.

  3. Selecting a range of cells, then editing one of them. As the user is editing the one cell, all the cells in the range should be updated to the value the user is typing.

I'm a relative JavaScript (and SlickGrid) newbie, so I'd love a little help with the JavaScript code to do this. Copying a single cell and pasting it into a range (option 2) doesn't seem too difficult, but I've no idea how to start doing a fill-down implementation. Any help would be very welcome.

Thanks!

warpech
  • 6,293
  • 4
  • 35
  • 36
  • What sort of UX are you looking for here? A spreadsheet-geared drag-down or a more structured edit like what you get when you select multiple songs in iTunes and edit them? – Tin Jun 21 '12 at 19:54
  • 1
    I'm looking to emulate the Excel UI, so a "spreadsheet-geared drag-down" for the fill handle would be perfect. – André Pang Jun 29 '12 at 21:30

1 Answers1

8

I've created a small plugin for SlickGrid to give a Drag Down.

It's available here.

When you've added the plugin you can hook up to an event, onFillUpDown, which will tell you the range of the fill. Using that you can do what you like, copy the values, or include the logic for the sequencing. There's an example of it working here (updated link).

user5670895
  • 1,488
  • 17
  • 29
danny-sg
  • 91
  • 1
  • 4
  • 1
    Danny, this is fantastic. I didn't expect a year-old question to have a solution so much later. Many thanks, I'll play around with your spreadsheet plugin! – André Pang Jun 06 '13 at 15:12
  • Danny, I would love to see this in action but your example link doesnt appear to work any longer. – contractorwolf Apr 04 '14 at 15:26
  • Sorry - [this link should work](http://danny-sg.github.io/slickgrid-spreadsheet-plugins/examples/example-1-everything.htm) and [this](http://danny-sg.github.io/slickgrid-spreadsheet-plugins/examples/example-2-everything.htm) for the second example – danny-sg Apr 30 '14 at 14:39