Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

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

Questions related to using nuBuilder Forte.
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 447 times
Contact:

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

Unread post 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');
			};   
		}
    });
}
calida82
Posts: 58
Joined: Mon Sep 09, 2019 8:20 am

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

Unread post 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
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 447 times
Contact:

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

Unread post by kev1n »

Use nuCurrentProperties().form_id to redirect to the current edit screen.
Post Reply