Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82114

How to include an additional field in Editor ajax/data callback?

$
0
0

Fairly new to JavaScript and using DataTables -- fantastic product so far.

My only issue is that when I perform a file upload (uploadMany option on my field), I need to also include the ID.

I've also noticed that id doesn't actually get substituted when the ajax call is made -- my debugger shows it LITERALLY going to /AudioClips/Edit?id=id, rather than /AudioClips/Edit?id=123123123123123123 (or some such thing)

 $(document).ready(function ()
    {

                editor = new $.fn.dataTable.Editor(
                    {
                        ajax: { 
                            type: "POST",
                            url: "/AudioClips/Edit?id=_id_"
                        },
                        idSrc: "id",
                        table: "#Table_7b1e6ea34e74470fa1b1836333a1f899",
                        fields: [
                            { name: "name", label: "Name" },
                            {
                                name: "clips",
                                label: "Audio Clip",
                                type: "uploadMany",
                                noFileText: "No Clips Uploaded.",
                                display: function (fileId, counter)
                                {
                                    return '<img src="' + editor.file('files', fileId).web_path + '"/>';
                                }
                            }
                        ]
                } );

                $('#Table_7b1e6ea34e74470fa1b1836333a1f899').on('click', 'tbody td', function (e)
                {
                    editor.inline(this);
                } );

It'd honestly be easier for me to include the DT_RowID in the actual data getting passed into the ajax -- so using the data() function inside of ajax { } would be far superior, if there is a method to that.

Any thoughts?


Viewing all articles
Browse latest Browse all 82114

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>