jennschiffer / timbles.js

a very simple jQuery plugin for tables, made by the person who literally did not invent tables
MIT License
38 stars 4 forks source link

Add plugin support #38

Closed edelooff closed 8 years ago

edelooff commented 8 years ago

Hey @jennschiffer,

In order for #5 to be handled in an extension, some things need to be exposed (methods), and it makes sense to make some other small changes in the name of single-responsibility. So this PR brings the following (API) changes:

  1. Header cell selection is moved to the function selectColumnHeaders(), no longer split between pre-existing tables and generated ones
  2. Creating the tableRows 'cache' is also moved to a function, selectTableBody()
  3. These two operations and the enabling of features are done in the configureTable() function, which is executed for both pre-existing and generated tables. This replaces setupExistingTable() and enableFeatures() and makes the two kinds of tables more similar in operation.
  4. Expose objects classes, copy and methods to the outside world, allowing plugins to hook into / replace methods with altered behavior.

Exposing all the methods wholesale like this feels a bit crude, but I don't see a clear and better way (though there probably is).

Other small changes:

edelooff commented 8 years ago

@jennschiffer, could you let me know whether this needs anything else/different, or whether you're happy with the proposed changes?

jennschiffer commented 8 years ago

hi! i'll have time on friday to take a look at all of this and test it out!

edelooff commented 8 years ago

Hi @jennschiffer, did you get a change to look at this yet?

edelooff commented 8 years ago

Hey Jenn, could you have a look at this so we can move this out of PR limbo?

jennschiffer commented 8 years ago

sorry for the wait, been v busy :santa: