Editor Component - Checkbox

Editor Component - Checkbox

juanasapjuanasap Posts: 6Questions: 0Answers: 0
edited February 2015 in Free community support

Hello,

I'm having some trouble when pop up for add/edit is trying to bind with information. The display table is showing me True or False with property from SQL table (type bit), so that's OK. My problem is when I try to edit the row, always is unchecked the checkbox.

This is my code...

editor = new $.fn.dataTable.Editor({
ajax: '/api/dataEdit/accountExclusions',
table: '#accountExclusion',
fields: [{
label: 'Exclude Position Match:',
name: 'ExcludePositions',
type: 'checkbox',
separator: '|',
options: [
{ label: '', value: 1 }
], 'default': 0
}
]
});

$('#accountExclusion').DataTable({
dom: 'Tfrtip',
ajax: '/api/dataEdit/accountExclusions',
columns: [
{
data: 'ExcludePositions',
className: 'dt-center',
'render': function (val, type, row) {
if (type === 'display') {
return val.toUpperCase() == 'FALSE' ? 'No' : 'Yes'
}

            return val
        }
    }
],
tableTools: {
    sRowSelect: "os",
    aButtons: [
        { sExtends: "editor_create", editor: editor },
        { sExtends: "editor_edit", editor: editor },
        { sExtends: "editor_remove", editor: editor }
    ]
}

});
}

Regards,

Replies

  • juanasapjuanasap Posts: 6Questions: 0Answers: 0

    I found the problem.

    I was getting False, True for ExcludePosition, so on options: [ { label: '', value: 1 } ] instead of 1 or 0, I set value: 'True'.

    Thanks anyway

This discussion has been closed.