jquery-datatables-editable - How to add a new row without the overlay?

jquery-datatables-editable - How to add a new row without the overlay?

sgallandsgalland Posts: 3Questions: 0Answers: 0
edited April 2013 in General
Hello,

I am using the jquery-datatables-editable plugin and have my table mostly working, except that I am trying to add a new row without using the overlay that pops up. All I need to do is add a new row to the table (but not to the database) that the user can edit. Once the user edits any of the data, then it will need to save to the database. I already have this configured for existing rows, but haven’t figured out how to add a new row without using the overlay. Any thoughts on how to just simply add a new row?

Thanks,
Sean

Replies

  • sgallandsgalland Posts: 3Questions: 0Answers: 0
    Here is the code for initializing the datatable with editable. Also I am dynamically building the columns since I am using pivot data from a database (thus the reason I can't directly insert this into a database when the row is created).
    [code]
    $(document).ready(function() {
    $('#time_editor').dataTable({
    'bProcessing': true,
    'bServerSide': true,
    'sAjaxSource': '/RedApple_SchoolAdmin/TimesheetController'
    }).makeEditable({
    "sUpdateURL": '/RedApple_SchoolAdmin/UpdateTimesheet',
    "aoColumns": [
    null,
    <% for (int i = 0; i < colCount; i++) {%>
    {
    indicator: 'Saving time punch',
    tooltip: '',
    type: 'text',
    onblur: 'cancel',
    submit: 'Save'
    },
    {
    indicator: 'Saving department change',
    tooltip: '',
    type: 'select',
    onblur: 'cancel',
    submit: 'Save',
    data: "<%= outputDepartments.toString()%>"
    },
    <%}%>
    ]});
    });
    [/code]

    The output already looks like this and saves with existing data
    [code]
    +----------------+
    | | 3/2 | 3/3 |
    +----------------+
    | In | 8:30 AM| 8:30 |
    +----------------+
    | Repeat next line... |
    +----------------+
    [/code]

    All I need to do is manually insert a row into the html table.

    Thanks,
    Sean
  • sgallandsgalland Posts: 3Questions: 0Answers: 0
    I think I solved the problem. I decided to explicitly just use jEditable - http://datatables.net/examples/api/editable.html

    That plugin is more up my ally.
This discussion has been closed.