AutoFill - new plug-in (now v.1.1)

AutoFill - new plug-in (now v.1.1)

allanallan Posts: 61,452Questions: 1Answers: 10,055 Site admin
edited September 2010 in Announcements
Hello all,

I'm very pleased to be able to release a all new first class plug-in for DataTables: AutoFill. AutoFill gives an Excel like option to a DataTable to click and drag over multiple cells, filling in information over the selected cells and incrementing numbers as needed. Easiest way to explain it is with an example:
http://datatables.net/release-datatables/extras/AutoFill/index.html

AutoFill will take account of input elements in the table and allows you to select which columns you want it to be available on. AutoFill requires DataTables 1.7 or newer.

Download (place the extracted package into the "extras" folder in the DataTables distribution for have the paths match):
http://datatables.net/releases/AutoFill-1.0.0.zip

Thanks to Phoniax AS ( http://www.phoniax.no/ ) for their sponsorship of this plug-in for DataTables! If you've got any ideas you'd like developed into a DataTables plug-in, please do get in touch ( http://datatables.net/contact ).

Regards,
Allan

Replies

  • ruzzruzz Posts: 49Questions: 0Answers: 0
    wow - that's pretty nifty Allan. Well done.

    Do you plan on supporting bump-scrolling? Or would you consider that unnecessary?

    ruzz
  • allanallan Posts: 61,452Questions: 1Answers: 10,055 Site admin
    Hi ruzz,

    Yes indeed. I think adding support for scrolling (both DataTables y scrolling and the browser window as a whole) will be quite a nice addition. The other feature to add is the ability to do it in the x direction as well as y. Not sure when tho... :-)

    Regards,
    Allan
  • ruzzruzz Posts: 49Questions: 0Answers: 0
    Excellent, Allan.

    Just to be clear, I've not tried the code yet, so apols if this is covered in the download somewhere...

    It's not clear from the demos if the starting values can be supplied via properties/callback/whatever. I see you're taking the first numeric selected and doing the obvious - but what if the aplha stuff should be "incremented", etc. What if I want to inc the numerics by 1.505, say. Perhaps via an extension/addition to aoColumnDefs or similar?

    Another use I can see is to "fill from range" where the range is supplied by me and you apply it and wrap around if the selection continues (e.g "red,orange,yellow,green,blue,indigo,violet" etc).

    ruzz
  • allanallan Posts: 61,452Questions: 1Answers: 10,055 Site admin
    Hi ruzz,

    That's some very good thinking - I like it :-). I had been considering something about like aoColumnDefs, with callback options (there currently aren't as it wasn't needed for the initial release) - so I might generalise that code in DataTables and make it available for plug-ins through the API. Having a callback function specific to each column certainly makes sense, and I really like the idea of being able to a fill from range - that's a very nice idea.

    Regards,
    Allan
  • lb.nicolb.nico Posts: 2Questions: 0Answers: 0
    Hi Allan,

    First of all thank you for everything you do! This is really fantastic.

    I have a small question about the autofill. Is it possible to save the updated data directly into the database via a callback or other.

    Thank you for your answer
    lbnico.
  • allanallan Posts: 61,452Questions: 1Answers: 10,055 Site admin
    Hi lbnico,

    At the moment no - but that would certainly make sense for something that can be done with a callback function. I'll see how readily that can be added in (probably a lot easier than the other suggestions ;-) ).

    Regards,
    Allan
  • ruzzruzz Posts: 49Questions: 0Answers: 0
    Oh, I see... we want "easy" now, do we?

    :)
  • allanallan Posts: 61,452Questions: 1Answers: 10,055 Site admin
    Here we go - v1.1.0 released. With this release:

    - Scrolling :-). Both scrolling the window and the DataTable (if scrolling is enabled) is supported. While dragging the AutoFill handler, the position will move as needed. Example: http://datatables.net/release-datatables/extras/AutoFill/scrolling.html

    - Callback functions: There are four callback functions for each column definition (fnRead, fnWrite, fnStep and fnCallback). These can be used to customise the way that reading and writing works, and also to update a database after the fill is complete. Example: http://datatables.net/release-datatables/extras/AutoFill/callbacks.html

    - Column definitions: Just like DataTables, aoColumns and aoColumnDefs are now supported, and targets work exactly the same way as in DataTables. This replaces aiColumns (so that won't work if you were using them with 1.0)!

    Download: http://datatables.net/releases/AutoFill-1.1.0.zip

    Hope you enjoy, and thanks for all the suggestions :-)

    Regards,
    Allan
  • giorgio79giorgio79 Posts: 43Questions: 0Answers: 0
    Hi Allan,

    Would you have some code on how to make this work with multiple columns?

    The user selects two or more columns, and drags them down or up to copy. :)
  • allanallan Posts: 61,452Questions: 1Answers: 10,055 Site admin
    At this time AutoFill is only supports a single column at a time. It is certainly possible to extend the code to make it work across multiple columns - and that's the next major upgrade that AutoFill will see - but it will take a fair bit of work to do :-)

    Allan
This discussion has been closed.