我正在开发和使用 asp.Net “JTable - JQuery (jtable.org)”。我只想在字段“Source”的值等于“M”时显示操作“updateAction”和“DeleteAction”。
<script type="text/javascript">
$(document).ready(function () {
// Define Tooltip temático para a página
$(document).tooltip();
// Configura Jtable Itens 1 com retorno Json através de Page Methods de toda a hierarquia, com 'Lazy Loading':
$('#ItensContainer').jtable({
title: 'Itens',
actions: {
createAction: 'ConItens.aspx/CreateItem',
listAction: 'ConItens.aspx/ListItens',
updateAction: 'ConItens.aspx/EditItem', // if (data.record.Source.toString() == "M")
deleteAction: 'ConItens.aspx/DeleteItem' // if (data.record.Source.toString() == "M")
},
fields: {
CodeItem: {
title: 'Item',
width: '9%',
edit: false,
},
Source: {
title: 'Source',
width: '10%',
create: false,
edit: false
},
LinkDetails: {
title: '',
width: '3%',
display: function (dados) {
var $link = '<a href="ConDetailsItem.aspx?CodeItem=' + dados.record.CodigoItem.toString() + '"><img class="Botoes-lupa-detalhes" src="Content/Images/ico_lupa.gif" border=0 title="Detalhe do item"></a>';
return $link;
},
create: false,
edit: false
}
}
});
}); // End - Document.ready