Welcome to the nuBuilder Forums!

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

3 questions in 1 (default sort and calendar)

Questions related to using nuBuilder Forte.
Post Reply
Mike1961
Posts: 17
Joined: Wed Aug 11, 2021 7:11 pm

3 questions in 1 (default sort and calendar)

Unread post by Mike1961 »

1) I want to display all the tasks from my team in the same order that were created, by default.
I noticed that the list is not growing that way.
default sort for the same date.jpg
How can I obtain this ? Should I add a (hidden) field, with the creation time or is it an easier way ?

In my case, the tasks were created by Michel/Michel/Michel/Luc/Michel/Simon

2) when somebody creates a task, I have a calendar to choose the date. This should be the date of the day, but also another one, if needed. is it a way to prepopulate this calendar with the date of the day ?
date of the day.jpg
3) about this calendar, this is my own problem (colorblind), the date of the day is not very visible (red ?). Should I change the code to choose another color (bigger bold blue by example) ?
today.jpg
Thank you
You do not have the required permissions to view the files attached to this post.
miasoft
Posts: 156
Joined: Wed Dec 23, 2020 12:28 pm
Location: Russia, Volgograd
Has thanked: 32 times
Been thanked: 7 times
Contact:

Re: 3 questions in 1 (default sort and calendar)

Unread post by miasoft »

Mike1961 wrote:1) I want to display all the tasks from my team in the same order that were created, by default.
I noticed that the list is not growing that way.
default sort for the same date.jpg
How can I obtain this ? Should I add a (hidden) field, with the creation time or is it an easier way ?
In my case, the tasks were created by Michel/Michel/Michel/Luc/Michel/Simon
u
Have you PRIMARY AUTOINCREMENT KEY for Tasks table? Use It in Browse (forms property):

Code: Select all

select * from tasks
WHERE ....
ORDER BY youPrimaryKey
About calendar- try to play with CSS in .\core\css\nubuider4.css

Code: Select all

 .nuCalendar {
	position:absolute;
	width:210px;
	height:213px;
	color:#000000;
	border-style:none;
	user-select: none
}

 #nuCalendar {
	box-shadow:5px 5px 5px 0 rgba(150,147,150,1)
}
 #nulink {
	position:absolute;
	right:55px;
	padding:5px;
	color:#dfdfdf
}
 .nuCalendarColor {
	background-color:#BADEEB
}
 .nuCalendarSelected:hover {
	
Wbr, miasoft.
miasoft
Posts: 156
Joined: Wed Dec 23, 2020 12:28 pm
Location: Russia, Volgograd
Has thanked: 32 times
Been thanked: 7 times
Contact:

Re: 3 questions in 1 (default sort and calendar)

Unread post by miasoft »

Mike1961 wrote:ere created by Michel/Michel/Michel/Luc/Michel/Simon

2) when somebody creates a task, I have a calendar to choose the date. This should be the date of the day, but also another one, if needed. is it a way to prepopulate this calendar with the date of the day ?
Insert in UserCode for you form:

Code: Select all

  function getCurrentDate() {
    var d = new Date();
  //  var df = nuPad2(d.getDate()) + '-' + nuPad2(d.getMonth() + 1) + '-' + d.getFullYear();
    var df = d.getFullYear() +'-' + nuPad2(d.getMonth() + 1)+ '-'+ nuPad2(d.getDate()) ;
    return df;
} 
function nuBeforeSave() {
    if (nuFORM.edited === true) {
       var d = getCurrentDate();
       $('#DATECHANGE').val(d).change();  //you must have field DATECHANGE in table
    }
}

if(nuIsNewRecord()){
    var d = getCurrentDate();
    $('#YouDATE').val(d).change();  
}
Wbr, miasoft.
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: 3 questions in 1 (default sort and calendar)

Unread post by kev1n »

Mike1961 wrote:1) I want to display all the tasks from my team in the same order that were created, by default.
I noticed that the list is not growing that way.
If you're not using an auto increment primary key, add a new column to your table of type timestamp and with a default value current_timestamp()
timestamp.jpg
In the Browse SQL, add an

Code: Select all

ORDER BY created_at 
Or with descending order to show the latest records on top of the list:

Code: Select all

ORDER BY created_at DESC
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: 3 questions in 1 (default sort and calendar)

Unread post by kev1n »

Mike1961 wrote: when somebody creates a task, I have a calendar to choose the date. This should be the date of the day, but also another one, if needed. is it a way to prepopulate this calendar with the date of the day ?

Code: Select all


if(nuIsNewRecord()){
	nuSetDateValue('Replace_with_your_date_object_id');
}

PS: Please, one question, one topic. It will be easier for us to answer them and for others to find answers in the future. Thanks!
Post Reply