why does this happen?
Code: Select all
// No action when clicking a cell
function nuSelectBrowse(e) {
return false;
}
function createButton(target, pk, label, title, openAction) {
let btn = $('<button type="submit" style="padding-top: 2px; height:27px; border: none; vertical-align: center; background-color: #378bd5; transform: translateY(-10%); color:white">'+ label +'</button>');
$(target).html(btn).attr('title', nuTranslate(title));
btn.on('click', function() {
openAction(pk);
});
}
function addButons(column, label, title, openAction) {
$("[data-nu-column='" + column + "']").each(function(index) {
var pk = $(this).attr('data-nu-primary-key');
if (typeof pk !== "undefined") {
createButton(this, pk, label, title, openAction);
}
})
}
function openEditForm(pk) {
nuForm(nuGetProperty('form_id'), pk, '', '', '0');
}
function openBrowseForm(pk) {
nuSetProperty('pk_cliente',pk,true);
nuForm('64da2a46ca706af', '', '', '', '0');
}
// Add an edit and browse button
// Icon list: https://fontawesome.com/v5/search?m=free
addButons(1, '<i class="fa fa-pencil"></i>', 'Modifica', openEditForm);
addButons(0, '<i class="fa fa-search"></i>', 'Elenco', openBrowseForm);
Code: Select all
function nuOnLoad(){
if(nuFormType() == 'browse'){
console.log(nuGetProperty('pk_cliente'));
}
}