showing xml content in datatable

showing xml content in datatable

berniebernie Posts: 1Questions: 1Answers: 0

Hi,
I hope you can help with a little problem which I have. Maybe I should mention that I am a beginner. Please be patient with me :-) This is my code:

    <!-- jQuery -->
    <script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>

    <!-- Audio Player -->
    <script type="text/javascript" src="js/AudioPlayer/js/audioplayer.js"></script>

    <!-- DataTables -->
    <link rel="stylesheet" type="text/css" href="js/DataTables-1.10.0/media/css/jquery.dataTables.css" />
    <script type="text/javascript" src="js/DataTables-1.10.0/media/js/jquery.dataTables.js"></script>

    <!-- JEditable -->
    <script src="js/jeditable/jquery.jeditable.js" type="text/javascript"></script>


    <!-- Validate -->
    <script src="js/validate/dist/jquery.validate.js" type="text/javascript"></script>

    <!-- dataTables JEditAble -->
    <script type="text/javascript" src="js/jquery.dataTables.editable.js" charset="utf-8"></script>

var oTable = $('#example').dataTable({
    "paging":   false,
    "ordering": true,
    "info":     false,
    "bProcessing": true,
    "columnDefs": [
            {"targets": [ 0 ],"visible": false, "searchable": false},
            {"targets": [ 1 ],"visible": true,  "searchable": true, "type": "string"},
            {"targets": [ 2 ],"visible": true,  "searchable": true, "type": "string"},
            {"targets": [ 3 ],"visible": true,  "searchable": true, "type": "string"}
    ],
    "order": [[ 3, "desc" ]]    

}).makeEditable( {
    sUpdateURL: function(value,settings)
    {
        var rowId = oTable.fnGetPosition(this)[0];
        var columnPosition = oTable.fnGetPosition(this)[1];
        var columnId = oTable.fnGetPosition(this)[2];
        var sColumnTitle = oTable.fnSettings().aoColumns[columnId].sTitle
        var Daten = oTable.fnGetData( rowId  );
        var rowDB = Daten[0];
        $.ajax({
            type: "POST",
            url: "ajax.php",
            data: "value="+value+"&rowId="+rowId+"&columnPosition="+columnPosition+"&columnId="+columnId+"&sColumnTitle="+sColumnTitle+"&RowDB="+rowDB,
            success: function(data){                    
                var json = $.parseJSON(data);
                var src1 = json.mp3file;
                var aData = oTable.fnGetData( rowId  );
                ID = aData[0];

                $("#player_r"+ID+"c"+columnId).attr("src", src1);
            }
        });
        return(value); //Simulation of server-side response using a callback function
    }


    } );

Everything works fine, except the last line: return(value);
When I enter text with some xml expressions like:
rail <break time="1"/> road </break> I will get the same expression from my ajax response.
After the return(value); I get (without the slash):
rail <break time="1"> road </break>
and in the table view I only see:
rail road
when I double click to edit I get:
rail <break time="1"> road </break>

My questions:
1. Is it possible to show the xml tags?
2. How can I stop datatable to remove my slash?

Thank you for your help

Bernd

Answers

  • allanallan Posts: 61,762Questions: 1Answers: 10,111 Site admin

    makeEditable is 3rd party software and not supported by myself. I'd suggest asking in the issue list for that software.

    Allan

This discussion has been closed.