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

Questions related to using nuBuilder Forte.

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

Postby calida82 » Mon Sep 09, 2019 4:37 pm

Hi my name is Daniele i'm a new user of nuBuilder.

Is it possible to insert 2 fields with 2 icons (edit and next) to each line of the browse form?
Clicking on the edit icon I would like to open the edit form of that record, while clicking on the next icon I would like to open a new browse form with the data of a new table linked with one to many relation to the record selected in the first browse form
One more question, when I edit a record and click on the save button the page remains the same, how do I automatically return to the browse form after pressing the save button?

I tried to load the corso.zip file in phpmyadmin the file is not loaded. the page load wheel turns infinitely I waited for more than an hour without success.
should the file be uploaded to a new database?

Daniele
calida82
 
Posts: 5
Joined: Mon Sep 09, 2019 3:50 pm

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

Postby admin » Mon Sep 09, 2019 6:01 pm

Daniele,

You can add whatever columns you want to a Browse Form and add your own icons.

You can change what happens when you click a Browse record by modifying nuSelectBrowse() in the Javascript section of a Form.

https://wiki.nubuilder.net/nubuilderforte/index.php/Javascript#nuSelectBrowse


Steven
admin
Site Admin
 
Posts: 3108
Joined: Mon Jun 15, 2009 9:53 am

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

Postby kev1n » Mon Sep 09, 2019 6:13 pm

calida82 wrote:Hi I tried to load the corso.zip file in phpmyadmin the file is not loaded. the page load wheel turns infinitely I waited for more than an hour without success.
should the file be uploaded to a new database?

Daniele


Does it work if you unzip it and upload the SQL file?
Upload it to an existing nuBuilder DB.
kev1n
 
Posts: 244
Joined: Mon Oct 15, 2018 2:13 am

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

Postby calida82 » Mon Sep 09, 2019 7:29 pm

Hi steven can you tell me how to add columns and icons? or show me some examples where I can see it?

On the web is there a complete application made with nuBuilder (of any kind) that i can download and study?


kev1n I tried also pulling out the .sql file and loading that directly but it doesn't work. the wheel turns at infinity.
I had already tried in a nuBuilder db.

I have another problem, with phpmyadmin I created 2 db and in the folder / var / www / html / I extracted nuBuilder in 2 separate folders and configured the file nuconfig.php to point everyone to his db but when I open the first app everything is ok , when I try to point to the second folder the name of the app changes but the app is that of the first folder.
calida82
 
Posts: 5
Joined: Mon Sep 09, 2019 3:50 pm

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

Postby admin » Tue Sep 10, 2019 11:53 am

calida82,

I suggest you learn how nuBuilder works before trying to reinvent the wheel.

BUT this is how you add another column in a Browse Form. How you add icons is up to you, probably with Javascript.

https://wiki.nubuilder.net/nubuilderforte/index.php/Forms#Columns_.28Subform.29

To your second question - you can find some simple apps here... https://www.nubuilder.com/downloads

To your third question - you can only have 1 nuBuilder App running in a browser at once time.


Steven
admin
Site Admin
 
Posts: 3108
Joined: Mon Jun 15, 2009 9:53 am

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

Postby kev1n » Tue Sep 10, 2019 3:50 pm

admin wrote:
To your third question - you can only have 1 nuBuilder App running in a browser at once time.

Steven


I have made the experience that several nuBuilder run at the same time without issues known to me. But after the installation I had to clear the cache and close the browser, otherwise data was loaded from the wrong DB.
kev1n
 
Posts: 244
Joined: Mon Oct 15, 2018 2:13 am

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

Postby calida82 » Wed Sep 11, 2019 12:34 am

BUT this is how you add another column in a Browse Form. How you add icons is up to you, probably with Javascript.

https://wiki.nubuilder.net/nubuilderforte/index.php/Forms#Columns_.28Subform.29

[/quote]
Hi, nubuilder could be a very powerful tool but it has a big flaw ... The documentation is little and you have to be in it to understand everything.
I followed the link you gave me and it is not explained how to add a column. Every single parameter is explained, too bad that it is not explained how it interacts with the rest. I added my column in the browse module options, in the last place I inserted the values ​​for the new column. when I launch the application the column is there, but the module is no longer connected to the database ... where before I had 10 records is now empty. I remove the column and the records come back.
calida82
 
Posts: 5
Joined: Mon Sep 09, 2019 3:50 pm

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

Postby kev1n » Wed Sep 11, 2019 1:12 am

When you add a new column, its field (title) must exist in the db. If it doesn't, the generated sql will result in an error when executed and you'll see a blank screen.
You could simply use the primary key of the table for the additional columns.

I recorded a video that shows how to add two additional columns and add icons to a column using javascript.

https://streamable.com/sfs7z


Javascript used in the example:

Code: Select all
if (nuFormType() == 'browse') {
    $('[data-nu-column="0"]').each(function (index) { // 1st column
        var cellId = $(this).attr('id');
         
         $('#' + cellId).html('<img src="graphics/select.png" alt="select"  ">');
       this.onclick = function() { alert('clicked!'); };       
    });
}
kev1n
 
Posts: 244
Joined: Mon Oct 15, 2018 2:13 am

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

Postby kev1n » Thu Sep 12, 2019 12:45 am

calida82 wrote:One more question, when I edit a record and click on the save button the page remains the same, how do I automatically return to the browse form after pressing the save button?


This can by done by adding this code to the form's JS field:

Code: Select all
if (nuFormType() == 'edit') {
   var l = window.nuFORM.breadcrumbs.length;
    if (l > 1) {
        nuGetBreadcrumb(l - 2);
    }
}
kev1n
 
Posts: 244
Joined: Mon Oct 15, 2018 2:13 am

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

Postby calida82 » Thu Sep 12, 2019 3:03 am

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.
to open a new form I can use nuForm (nuGetProperty ('form_id'), r, '', '', '0', '1'); ?
calida82
 
Posts: 5
Joined: Mon Sep 09, 2019 3:50 pm

Next

Return to General