Page 1 of 2
Add 2 icon fields to each row to the browse/search form
Posted: Mon Sep 09, 2019 9:07 am
by calida82
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
Re: Add 2 icon fields to each row to the browse/search form
Posted: Mon Sep 09, 2019 10:31 am
by admin
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.cloud/ ... lectBrowse
Steven
Re: Add 2 icon fields to each row to the browse/search form
Posted: Mon Sep 09, 2019 10:43 am
by kev1n
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.
Re: Add 2 icon fields to each row to the browse/search form
Posted: Mon Sep 09, 2019 11:59 am
by calida82
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.
Re: Add 2 icon fields to each row to the browse/search form
Posted: Tue Sep 10, 2019 4:23 am
by admin
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.cloud/ ... Subform.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
Re: Add 2 icon fields to each row to the browse/search form
Posted: Tue Sep 10, 2019 8:20 am
by kev1n
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.
Re: Add 2 icon fields to each row to the browse/search form
Posted: Tue Sep 10, 2019 5:04 pm
by calida82
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.cloud/ ... Subform.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.
Re: Add 2 icon fields to each row to the browse/search form
Posted: Tue Sep 10, 2019 5:42 pm
by kev1n
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!'); };
});
}
Re: Add 2 icon fields to each row to the browse/search form
Posted: Wed Sep 11, 2019 5:15 pm
by kev1n
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);
}
}
Re: Add 2 icon fields to each row to the browse/search form
Posted: Wed Sep 11, 2019 7:33 pm
by calida82
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'); ?