Sto provando ad utilizzare DataTables per un semplicissimo archivio documentale.
L'elenco lo creo bene..anche l'update.. il problema sorge per l'inserimento:
nel div di inserimento ho vari campi e l'ultimo è di tipo file (per upload).
Quando invio mi dice:
DataTables warning (table id = 'example'): Added data (size 6) does not match known number of columns (7)
questo è il codice della pagina php
Codice PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<?php
include "connect.inc.php";

$result mysql_query("SELECT documento.iddocumento, documento.titolo, documento.data, documento.pathfile, categoria.nomecategoria, evento.nome, argomento.nomeargomento
FROM documento, categoria, evento, argomento
WHERE documento.idcategoria = categoria.idcategoria
AND documento.idevento = evento.idevento
AND documento.idargomento = argomento.idargomento
"
);
?>
<html><head>
        <meta http-equiv="Content-type" content="text/html; charset=UTF-8">
        <title>DataTables (table plug-in for jQuery) Column Filter Add-on</title>
        
        <link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/media/images/favicon.ico">
        <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="http://www.datatables.net/rss.xml">
        
        <style type="text/css" media="screen">
            @import "media/css/demo_page.css";
            @import "media/css/demo_table.css";
            @import "media/css/site_jui.css";
            @import "media/css/demo_table_jui.css";
            @import "media/css/themes/base/jquery-ui.css";
            @import "media/css/themes/smoothness/jquery-ui-1.7.2.custom.css";
            /*
             * Override styles needed due to the mix of three different CSS sources! For proper examples
             * please see the themes example in the 'Examples' section of this site
             */
            .dataTables_info { padding-top: 0; }
            .dataTables_paginate { padding-top: 0; }
            .css_right { float: right; }
            #example_wrapper .fg-toolbar { font-size: 0.8em }
            #theme_links span { float: left; padding: 2px 10px; }
        </style>

        
        <script type="text/javascript" src="media/js/complete.js"></script>
        <script src="media/js/jquery-1.4.4.min.js" type="text/javascript"></script>
        <script src="media/js/jquery.dataTables.min.js" type="text/javascript"></script>
        <script type="text/javascript" src="media/js/jquery.dataTables.editable.js"></script>
        <script src="media/js/jquery.jeditable.js" type="text/javascript"></script>
        <script src="media/js/jquery-ui.js" type="text/javascript"></script>
        <script src="media/js/jquery.validate.js" type="text/javascript"></script>

        <script type="text/javascript" charset="utf-8">

            $(document).ready( function () {
                var id = -1;//simulation of id
                $('#example').dataTable({ bJQueryUI: true,

                            "sPaginationType": "full_numbers"}).makeEditable({

                                    sUpdateURL: "UpdateData.php",

                                     sAddURL: "AddData.php",
                                     sAddHttpMethod: "POST",
                                    
                                    sDeleteHttpMethod: "GET",
                                    sDeleteURL: "DeleteData.php",
                                    
                                    "aoColumns": [
                                            {     sName: "colCodice",
                                                sReadOnlyCellClass: "read_only"

                                            },
                                            {
                                                sName: "colData",
                                                indicator: 'Salvataggio...',
                                                tooltip: 'Clicca per editare',
                                                submit:'Salva',
                                                sType:"date"
                                            },
                                            {
                                                sName: "colTitolo",
                                                indicator: 'Salvataggio...',
                                                tooltip: 'Clicca per editare',
                                                type: 'textarea',
                                                submit:'Salva'
                                            },
                                            {
                                                sName: "colCategoria",
                                                indicator: 'Saving Engine Version...',
                                                tooltip: 'Click to select engine version',
                                                loadtext: 'loading...',
                                                type: 'select',
                                                onblur: 'cancel',
                                                submit: 'Ok',
                                                loadurl: 'categorie.txt',
                                                loadtype: 'GET'
                                            },
                                            {
                                                sName: "colArgomento",
                                                indicator: 'Saving Engine Version...',
                                                tooltip: 'Click to select engine version',
                                                loadtext: 'loading...',
                                                type: 'select',
                                                onblur: 'cancel',
                                                submit: 'Ok',
                                                loadurl: 'argomenti.txt',
                                                loadtype: 'GET'
                                            },
                                            {
                                                sName: "colEvento",
                                                indicator: 'Saving Engine Version...',
                                                tooltip: 'Click to select engine version',
                                                loadtext: 'loading...',
                                                type: 'select',
                                                onblur: 'cancel',
                                                submit: 'Ok',
                                                loadurl: 'eventi.txt',
                                                loadtype: 'GET'
                                            },
                                            {
                                                sName: "colPdf",
                                                sReadOnlyCellClass: "read_only"

                                            }
                                            
                                    ],
                                    oAddNewRowButtonOptions: {    label: "Nuovo...",
                                        icons: {primary:'ui-icon-plus'} 
                                    },
                                    oDeleteRowButtonOptions: {    label: "Elimina", 
                                        icons: {primary:'ui-icon-trash'}
                                    },
                                    oAddNewRowFormOptions: {     
                                        title: 'Nuovo Documento',
                                        show: "blind",
                                        hide: "explode",
                                        modal: true
                                    },
                                    sAddDeleteToolbarSelector: ".dataTables_length"                                

                                });
                
            } );
            
            
        </script>

        <script type="text/javascript">

            var _gaq = _gaq || [];
            _gaq.push(['_setAccount', 'UA-17838786-2']);
            _gaq.push(['_trackPageview']);

            (function () {
                var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
                ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
                var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
            })();

</script>
    </head>
    

<body id="index" class="grid_2_3">

                <div class="css_clear css_spacing"></div>
                
                <h3>Example</h3>
                <div class="full_width">
<form id="formAddNewRow" action="#" title="Add a new browser" style="width:600px;min-width:600px">
<label for="codice">Codice</label>

 <?php
     $resultMaxIdDocumento 
mysql_query("SELECT max(iddocumento) FROM documento");
    
$rowMaxIdDocumento mysql_fetch_array($resultMaxIdDocumento);
    
$maxIDDocumento=$rowMaxIdDocumento[0]+1;
?>    <input name="codice" id="codice" rel="0" value="<?php echo $maxIDDocumento?>" disabled />

        

        
    <label for="data">Data</label>

    <input type="text" name="data" id="data" class="required" rel="1" />
        

    <label for="titolo">Titolo</label>

    <input type="text" name="titolo" id="titolo" class="required" rel="2" />
        

    <label for="categoria">Categoria</label>

    <select name="categoria" id="categoria" rel="3">
<?php
    $resultRiempiArgomentoAdd 
mysql_query("SELECT idcategoria,nomecategoria FROM categoria");
    while (
$rowArgomentiAdd mysql_fetch_array($resultRiempiArgomentoAdd)) {

         echo 
"<option value=\"$rowArgomentiAdd[idcategoria]\">$rowArgomentiAdd[nomecategoria]</option>";

}
?>
        </select>
        

    <label for="argomento">Argomento</label>

    <select name="argomento" id="argomento" rel="4">
<?php
    $resultRiempiArgomentoAdd 
mysql_query("SELECT idargomento,nomeargomento FROM argomento");
    while (
$rowArgomentiAdd mysql_fetch_array($resultRiempiArgomentoAdd)) {

         echo 
"<option value=\"$rowArgomentiAdd[idargomento]\">$rowArgomentiAdd[nomeargomento]</option>";

}
?>
        </select>
        

    

               
        

        <label for="evento">Evento</label>

    <select name="evento" id="evento" rel="5">
<?php
    $resultRiempiArgomentoAdd 
mysql_query("SELECT idevento,nome FROM evento");
    while (
$rowArgomentiAdd mysql_fetch_array($resultRiempiArgomentoAdd)) {

         echo 
"<option value=\"$rowArgomentiAdd[idevento]\">$rowArgomentiAdd[nome]</option>";

}
?>
        </select>
        

        <label for="file">PDF:</label>
<input type="file" name="file" id="file" rel="6">


        

</form>

                <table id="example" class="display">
                    <thead>
                        <tr>
                            <th>CODICE</th>
                            <th>DATA</th>
                            <th>TITOLO</th>
                            <th>CATEGORIA</th>
                            <th>ARGOMENTO</th>
                            <th>EVENTO</th>
                            <th>PDF</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                        
while ($row mysql_fetch_array($result)) {
                            
?>
                            <tr id="<?php echo $row['iddocumento'];?>">
                                <td><?php echo $row['iddocumento'];?></td>
                                <td><?php echo data_it($row['data']); ?></td>
                                <td><?php echo $row['titolo']; ?></td>
                                <td><?php echo $row['nomecategoria']; ?></td>
                                <td><?php echo $row['nomeargomento']; ?></td>
                                <td><?php echo $row['nome']; ?></td>
                                <td>[url="file/<?php echo $row['pathfile']; ?>"][img]media/images/pdf.png[/img][/url]</td>
                            </tr>
                            <?php
                        
}
                        
?>
                    </tbody>
                </table>
                </div>
            </div>
        </div>
    </body>
</html>