This repository was archived by the owner on Apr 17, 2019. It is now read-only.
  
  
  
  
Fix for complex options rendering and adds table->hideColumn() for hidden columns (like primary key) #264
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
This is a really great library - but I ran across two problems with it.
First, complex options rendering wasn't working properly. For instance, when using table tools which required a complicated bit of javascript to specify: eg
I found the tableTools structure not rendering properly for a variety of reasons - among them being a lack of recursion and no way to specify that a value was actually a javascript function name and shouldn't be quoted. I replace the template based rendering of the structure with a couple private recursive functions in Table itself and pass the fully rendered options string instead. I noticed that the original code would look for values starting with 'function' to guess if it were a javascript function that shouldn't be quoted. This is retained, however in my case I already had a javascript function I wanted to use as a callback. To fix this, I also added support for the javascript: uri scheme. Thus the above options looks like this in php now.
I left the callbacks on the "Remove" button in the old style - either form does a javascript call on the function with this bound to the table.
The second feature I added was the ability to provide hidden columns. Generally, I need the primary key of a record to do anything but I don't necessarily want to show it to the user. So I added hideColumn to Table. It works a bit like addColumn except the column must already exist. You can use the index, name or alias.