FormHandler table code review
-
Code corrections
-
Do not use encodeURIComponent to escape selectors. Use quotes instead. Remove quotes if they exist in the name -
Do we need to check for if (dirty_td.length > 0) {
-
options.edit.editFunction()
should probably beoptions.edit.editFunction
-- and should probably beedit.function
. Also call editFunction on.done()
if it is defined. Not viacomplete:
. Always use promises -
if (options[name] == 'grid') name = 'table_grid'
is duplicated -
Rename compile_template()
torender_template()
and document it
-
-
Documentation
-
Add row needs documentation -
Actions are poorly explained -
Add example of how to use icon function
-
-
Usability
-
If the server responds with a Bad Request, show the actual error message -
When using keyboard navigation, changed inputs are not detected as dirty -
Loading indicator is not visible -
Simulate server / network failure and test. If data is lost, user should be aware -
After adding a row and saving, the row should remain where it was added (i.e. at the top of the table) -
All functions must accept a single object with these names (unless it's impossible.) -
data
: the dataset fromsrc
-
row
: row data - dict of {name: value} -
index
: row index -
name
: column name -
value
: cell data value -
link
: cell link value -
format
: formatted cell display value
-
-
How can a developer add a delete button simply?
-
-
Feature enhancements
-
Icon URLs are static. They must be based on the row data -- as a string template or function
-
Edited by Tejesh