Giter Site home page Giter Site logo

torrobinson / jquery-editable-table Goto Github PK

View Code? Open in Web Editor NEW
13.0 2.0 6.0 68 KB

✏️ A small jQuery extension to turn a static HTML table into an editable one. For quickly populating a small table with JSON data, letting the user modify it with validation, and then getting JSON data back out.

jquery table editable editable-table editable-grid

jquery-editable-table's Introduction

jquery-editable-table's People

Contributors

torrobinson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

jquery-editable-table's Issues

allow user to add configurable header & footer

Here is an example for the extended header & footer configuration:

{
            index: 2,
            header: 'Share (EUR)',
            headerClasses: ['editable-table-header', 'text-center'],
            footer: '0',
            footerClasses: ['editable-table-footer', 'text-center', 'no-editor', 'sum-result'],
            name: 'share_eur',
            classes: flatten(['text-center', 'sum-col', 'percent-partial-value-row', additionalClasses]),
            isValid: isValidFloat,
            afterAdd: (value, cell) => updateSums(table, tableElement, tableDataFieldId, value, cell),
            afterChange: (value, cell) => updateSums(table, tableElement, tableDataFieldId, value, cell),
            convertOut: convertToFloat,
}

I've added header, headerClasses, footer, footerClasses to be able to use a such dynamic configuration for header & footer.

Add `validationErrorHandler(message)` to global config

  1. Make isValid assume that the result is === true to be considered valid
  2. Assume isValid returns a validation error message if validation failed
  3. Add validationErrorHandler(message) to the global config. This callback should be called with the results of isValid when it isValid() !== true explicitly.

This allows the user to A) return custom validation messages per column, and B) display the exception in their own way (via toasts, custom labels, etc)

Ill-formed markup in case of XHTML

The line element.find('thead tr').append($('<th actions></th>')); tries to insert markup which is ill-formed XML and causes an error if in an XHTML document. Should be actions="".

allow user to update cell value in afterChange

allow user to update cell value in updatedValue
e.g.

        // Bind user-specified events if they exist
        if (typeof columnDef.afterChange == 'function') {
            let updatedValue = columnDef.afterChange(newValue, td);
            if (updatedValue) td.text(updatedValue);
        }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.