Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8940703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:06:27+00:00 2026-06-15T11:06:27+00:00

I am using jquery-datatables-editable and am trying to set the value that gets posted

  • 0

I am using jquery-datatables-editable and am trying to set the value that gets posted on update.
According to the documentation this can be done by setting the sName property(which belongs to aoColumns).
I have tried following the examples, both defining in aoColumns and aoColumnDefs with no luck.

Any ideas?
Code samples;

In view:

<?php
<div>
    <button id="p_btnAddNewRow">Add</button>
    <button id="p_btnDeleteRow">Delete</button>

    <div id="p-container">
        <table cellpadding="0" cellspacing="0" border="0" class="display" id="p-table">
            <thead>
                <tr>
                    <th>ID</th>
                    <th>Name</th>
                    <th>Notes</th>
                </tr>
            </thead>
            <tbody>
                <?php
                if (isset($p['primary']) && is_array($p['primary']) && (count($p['primary']) > 0)) {
                    foreach ($p['primary'] as $primary) {
                ?>
                <tr id="<?php echo $primary->id; ?>">
                    <td><?php echo $primary->code; ?></td>
                    <td><?php echo $primary->name; ?></td>
                    <td><?php echo $primary->notes; ?></td>
                </tr>
                <?php
                    }
                }
                ?>
            </tbody>
        </table>
    </div>
</div>
?>

JS;

<script type="text/javascript">

var pTable;
$(function() {
    pTable = $('#primary-audiences-table').dataTable().makeEditable({
        sAddNewRowFormId: "p_formAddNewRow",
        sAddNewRowButtonId: "p_btnAddNewRow",
        sAddURL: "/templates/ptable/add",
        fnOnNewRowPosted: function(data) {
                            if(data.indexOf("Error", 0) == 0) {
                                //Show error message
                                return false;
                            } else {
                                //Show success message and add row
                                return true;
                            }
                        },
        sUpdateURL: "/templates/ptable/edit",
        sDeleteRowButtonId: "p_btnDeleteRow",
        sDeleteURL: "/templates/ptable/delete",
        "aoColumns": [
                        {
                            sName: 'code',
                            indicator: 'Saving ID...',
                            tooltip: 'Double Click to edit',
                            type: 'textarea',
                            submit: 'Save changes'
                        },
                        {
                            sName: 'name',
                            indicator: 'Saving name...',
                            tooltip: 'Double Click to edit',
                            type: 'textarea',
                            submit: 'Save changes'
                        },
                        {
                            sName: 'notes',
                            indicator: 'Saving notes...',
                            tooltip: 'Double Click to edit',
                            type: 'textarea',
                            submit: 'Save changes'
                        }
                ]
    });
});

Sample response (print_r of $_POST):

(
    [value] => test
    [id] => 2784
    [rowId] => 0
    [columnPosition] => 0
    [columnId] => 0
    [columnName] => ID <- should be **code**
)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T11:06:29+00:00Added an answer on June 15, 2026 at 11:06 am

    I have found the answer: give the programmer more coffee (thats me) and read the documentation properly!!

    The sName property is associated to the dataTables extension, NOT the makeEditable extension. The example in the documents does show this but I failed to read properly; my bad.

    Therefore the correct way to write it is;

    <script type="text/javascript">
    
    var pTable;
    $(function() {
        pTable = $('#primary-audiences-table').dataTable({
            aoColumns: [ {"sName": "code"}, {"sName": "name"}, {"sName": "notes"} ]
        }).makeEditable({
            sAddNewRowFormId: "p_formAddNewRow",
            sAddNewRowButtonId: "p_btnAddNewRow",
            sAddURL: "/templates/ptable/add",
            fnOnNewRowPosted: function(data) {
                                if(data.indexOf("Error", 0) == 0) {
                                    //Show error message
                                    return false;
                                } else {
                                    //Show success message and add row
                                    return true;
                                }
                            },
            sUpdateURL: "/templates/ptable/edit",
            sDeleteRowButtonId: "p_btnDeleteRow",
            sDeleteURL: "/templates/ptable/delete",
            "aoColumns": [
                            {
                                indicator: 'Saving ID...',
                                tooltip: 'Double Click to edit',
                                type: 'textarea',
                                submit: 'Save changes'
                            },
                            {
                                indicator: 'Saving name...',
                                tooltip: 'Double Click to edit',
                                type: 'textarea',
                                submit: 'Save changes'
                            },
                            {
                                indicator: 'Saving notes...',
                                tooltip: 'Double Click to edit',
                                type: 'textarea',
                                submit: 'Save changes'
                            }
                    ]
        });
    });
    
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the jQuery DataTables plugin to do filtering on a set of
I am using the jquery plugin datatables and am trying to take advantage of
I am using jquery datatables and MS XSS library. I did this AntiXss.HtmlEncode(MyDate.ToString(MM/dd/yyyy h:mm
I'm using jQuery DataTables in my .NET web application but how do I set
In my project, i am using the jquery pagination of jquery.dataTables.min.js. In that when
I am using jquery plugin datatables and the css demo_table.css that has been using
I'm using jQuery DataTables . This is my markup: <div class='wrapper'> <form> <table> <tr>
I'm using datatables jquery plugin for beautifying my tables. I'm trying to stylize the
I am using the datatables jquery plugin. I am trying to use it as
I am using a jquery script called datatables, this adds a lot of functions

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.