On clicking editor field, displaying ID value instead of Label value

On clicking editor field, displaying ID value instead of Label value

MeinaMeina Posts: 4Questions: 2Answers: 1
edited July 2016 in Free community support

Here is my code,

var editor = new $.fn.dataTable.Editor({
                table: '.organisational-goal-inline-editor',
                idSrc: 'id',
                fields: [{
                        label: "Focus area",
                        name: "focus_area", 
                        type: "autoComplete",
                        opts: {
                            source: output
                        }
                    }..........................




 var table = $(#example).DataTable({

 columns: [
                    {
                        data: null,
                        defaultContent: '',
                        className: 'select-checkbox',
                        orderable: false
                    },
                    {
                        data: "focus_area",
                        editField: "focus_area",
                        render: function (val, type, row) {
                            var focus_id = val;
                            return $.map(output, function (v) {
                                return v.value === focus_id ? v.label : null;
                            });

                        }
                    },

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,863Questions: 1Answers: 10,135 Site admin

    We'd really need a link to a test case showing the issue, but my guess is that focus_area is the id? To be honest, I've found the jQuery UI AutoComplete very difficult to use and get it rendering a custom label. The Select2 and Selectize options are (imho) much easier to use.

    Allan

  • MeinaMeina Posts: 4Questions: 2Answers: 1

    Thank you for your reply.

    Yes focus_area is a id.. I used selectize its displaying label name correctly on inline editor but nothing displaying on Add new form for the focus_area do you know the reason?

  • allanallan Posts: 61,863Questions: 1Answers: 10,135 Site admin

    Not off the top of my head I'm afraid. Is it just a static list of options you are populating the control with, or is it dependent on some other field?

    Allan

  • MeinaMeina Posts: 4Questions: 2Answers: 1
    Answer ✓

    Anyway thank you very much.. Its due to css z-index property.

This discussion has been closed.