Hi, I failed to use selects with jEditable

Hi, I failed to use selects with jEditable

bacloud14bacloud14 Posts: 16Questions: 3Answers: 0

Hi there!
I want the default value from other select values is chosen by server code, then when the field is clicked to edit in the inline editing using jEditable, the field appears like a dropdown select menu. I couldn't achieve that.
here is my JS code:

$(document).ready(function() {
var table = $('#table_id').dataTable({
"iDisplayLength": 50,

                                    "columns": [
                                    {
                                        "className": 'details-control',
                                        "orderable": false,
                                        "searchable": false,
                                        "data": null,
                                        "defaultContent": ''
                                    }, {
                                        "data": "text"
                                    }, {

                                        "data" : "change",
                                        "render": function ( data, type, row ) {
                                            if ( data == "Improvement" )
                                            {   
                                                return  "<span class='label label-info'>Improvement</span>";
                                            }
                                            if ( data == "Bugfix" )
                                            {   
                                                return  "<span class='label label-danger'>Bugfix</span>";
                                            }
                                            if ( data == "Changement" )
                                            {   
                                                return  "<span class='label label-default'>Changement</span>";
                                            }
                                            if ( data == "New" )
                                            {   
                                                return  "<span class='label label-success'>New</span>";
                                            }

                                        }
                                    }]
                });

and this is my JSP code:

            <tbody>
                <c:forEach items="${features}" var="feature">
                    <tr id="${feature.hash}">
                    <td class="excluded"></td>
                        <td>
                            <c:out value="${feature.text} " /> </td>
                        <td>
                            <c:out value="${feature.change} " /> </td>
                    </tr>
                </c:forEach>
            </tbody>

unfortunatly when I click the textfield, the whole text appears like the following:

<span class='label label-success'>New</span>

Thanks in advance.

This question has accepted answers - jump to:

Answers

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75
    Answer ✓

    You sure that jEditable is the best thing to use? Im assuming your goals are to basically just have it so you can edit the values of each cell.

    Well first off, I would suggest just shelling out the money for Datatables Editable. Its something I HIGHLY regret not doing ahead of time, and I will surely do soon. If you dont want to purchase it while you are developing it, im sure you can work something out with Allan.

    If you are fixed on not spending any money for this, then I would suggest using jQuery x-editable instead, its what I use, and it works perfectly.

    With that, YADCF, and the DataTables hooks/API, there really hasnt been much I couldnt accomplish.

  • bacloud14bacloud14 Posts: 16Questions: 3Answers: 0

    Hi jLinux,
    What can I say about X-editable!! it's just awesome, I'm not a JS a Jquery guy, I would ask my friend to customize it for me. about Datatables Editable I don't think that I really need this whole perfect plugin, so for now I think X-editable or jEditable will compete, the easiest to implement will be used.
    So thanks again JLinux

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75
    Answer ✓

    Well Datatables Editable is probably the easiest, I can say that for sure after using x-editable.

    But if you MUST use x-editable, then cool. If you get stuck on anything. let me know and maybe I can help, I've done quite a bit with DT + x-editable

This discussion has been closed.