I am trying to make disable the entire table using datatable.net.
$('#documentTypeID').dataTable({
"sDom": "<'row-fluid'>t<'row-fluid'<'span6'i><'span6'p>>",
"bAutoWidth": false,
"bProcessing": true,
"bDestroy": true,
"stateSave": true,
"sAjaxSource": '<%= Page.ResolveClientUrl("XXX") %>',
"aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "<%= ExtranetResource.DataTable_LengthMenuAll_Text %>"]],
select: {
style: 'single',
className: 'focusedRow',
selector: 'td:last-child a'
},
"aoColumnDefs": [
{ "aTargets": [0], "sTitle": "<%= X.DocumentType %>" },
{ "aTargets": [1], "sTitle": "<%= X.StandardParameter %>" },
{ "aTargets": [2], "sTitle": "<%= X.Choice %>",
render: function ( data, type, row ) {
if(row[1] != undefined && row[1] != ''){
var $select = $("<select></select>", {
"id": row[0]+"choice",
"value": data
});
$.each(documentTypeOption, function(index,val){
var $option = $("<option></option>", {
"text": val.txt,
"value": val.v
});
if(data === val.v){
$option.attr("selected", "selected")
}
$select.append($option);
});
return $select.prop("outerHTML");
}else{
return '';
}
}}
],
"fnServerData": function (sSource, aoData, fnCallback) {
$.ajax({
"dataType": 'json',
"contentType": "application/json; charset=utf-8",
"type": "POST",
"url": sSource,
"success": function (msg) {
var json = jQuery.parseJSON(msg.d);
fnCallback(json);
},
"error": function (xhr, ajaxOptions, thrownError) {
alert(xhr.responseJSON.Message);
alert(thrownError);
}
});
}
});
I take this way to disable the table
var paperLessTable= $('#documentTypeID').dataTable;
if(paperLessTable != null){
table.rows().every( function (index) {
var row = table.row( index );
row.prop('disabled', true);
} );
But it doesn't work. I am from WPF and i started asp.net for 2 weeks now, i have some issue to change my mind from wpf to web. In my table, only one column had the combobox and i want to disable this control when i click on one button and that's why i started to parserows to disable each row one by one because there is no global function to do it. (I didn't find it in the doc).
When i say disable, i want the combobox blocked and the user can not select a value.
Aucun commentaire:
Enregistrer un commentaire