Re: Add 2 icon fields to each row to the browse/search form
Posted: Wed Sep 11, 2019 9:28 pm
Just check if the cell is not empty:calida82 wrote:Hi thanks for the answer I tried and it works. but there is a way to add the icon only where there are records? in this way he adds it to all the lines even if there are no records.
Code: Select all
if (nuFormType() == 'browse') {
$('[data-nu-column="0"]').each(function (index) { // 1st column
var cellId = $(this).attr('id');
var cell = $('#' + cellId);
if (cell.html() != '') {
cell.html('<img src="graphics/select.png" alt="select" ">');
this.onclick = function() { alert('clicked!'); };
}
});
}
You need to replace the variable r with the record id. So it will look like this:calida82 wrote: to open a new form I can use nuForm (nuGetProperty ('form_id'), r, '', '', '0', '1'); ?
i
Code: Select all
f (nuFormType() == 'browse') {
$('[data-nu-column="0"]').each(function (index) { // 1st column
var cellId = $(this).attr('id');
var cell = $('#' + cellId);
if (cell.html() != '') {
$(this).data('record_id', cell.html());
cell.html('<img src="graphics/select.png" alt="select" ">');
this.onclick = function() {
var r = $(this).data('record_id');
nuForm (nuGetProperty ('form_id'), r, '', '', '0');
};
}
});
}