Page 2 of 2

Re: Add 2 icon fields to each row to the browse/search form

Posted: Wed Sep 11, 2019 9:28 pm
by kev1n
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.
Just check if the cell is not empty:

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!'); };   
		}
    });
}
calida82 wrote: to open a new form I can use nuForm (nuGetProperty ('form_id'), r, '', '', '0', '1'); ?
You need to replace the variable r with the record id. So it will look like this:

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');
			};   
		}
    });
}

Re: Add 2 icon fields to each row to the browse/search form

Posted: Thu Sep 12, 2019 11:26 am
by calida82
Hi
i'm trying your code

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() != '') {
                  
         $(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 ('FF1'), r, '', '', '0');
         };   
      }
    });
}

but when i press on the icon
I am redirected to the first home page of nubuilder.

but nuGetProperty what does he do?
because in the wiki says
nuForm(string1, string2,string3,string4,string5)
but in the example appear nuGetProperty.....
i try with NuForm('FF1',r,'','','0');

but an empty edit page opens without fields

Re: Add 2 icon fields to each row to the browse/search form

Posted: Sat Sep 14, 2019 4:50 pm
by kev1n
Use nuCurrentProperties().form_id to redirect to the current edit screen.