I am using a calendar in my project and after using the information
i want to set it back to default and i am having a trouble with it
Edit :
sorry for any misunderstanding, lets say the user changed the calendar,
how can i set it to the way it was before the user changed it (no marks of dates and back to the previous way it was)
okey i found it:
calendar.SelectedDate = null;
calendar.DisplayDate = DateTime.Today;
Related
Vaadin 12.0.3
I have a helper method that returns ListDataProvider for Days of the Month. When User changes Month, I recall the helper method and reset DataProvider to reflect the new Day range.
filterDay.setDataProvider(IndexViewHelper.getCalendarDaysDataProvider(year, month));
The problem is that setting DataProvider on ComboBox removes currently selected option. To prevent this, I need to do something like this:
var currentValue = filterDay.getValue();
filterDay.setDataProvider(IndexViewHelper.getCalendarDaysDataProvider(year, month));
if(currentValue exists in the new list) filterDay.setValue(currentValue);
Is there a better way to do this? Basically, I would hope that setDataProvider() would not reset currently selected option if that option exists in the newly supplied list.
I know this can get very complex, especially with paging results. I just wanted to ask this on the forum in case there are better ways to deal with the issue.
I want to create a salesforce app. That have trigger on user creation. I need to make it optional by including a checkbox on user creation page.(i.e : the trigger have to start only when my custom checkbox is selected).
How to add custom checkbox in "User creation" page programatically using Apex ?Is it possible or not ?
I tried with MetaData API as :
MetadataService.MetadataPort service = new MetadataService.MetadataPort();
service.SessionHeader = new MetadataService.SessionHeader_element();
service.SessionHeader.sessionId = UserInfo.getSessionId();
List<MetadataService.Metadata> fields = new List<MetadataService.Metadata>();
MetadataService.CustomField customField = new MetadataService.CustomField();
customField.fullName = 'User.custom_create_field__c';
customField.label = 'Custom created field';
customField.defaultvalue = 'false';
customField.sharingModel = 'ReadWrite';
customField.type_x = 'Checkbox';
fields.add(customField);
MetadataService.AsyncResult[] results = service.create(fields);\\trows session timeout error here
But the last line throws session timeout error. Am I going in correct way to achieve my need? If so how to solve session timeout error?
Why do you want to do this programmatically? What's the problem with adding the checkbox declaratively to the object and to the layouts?
By adding the field to the object metadata as you're doing here, you'll still need to manually add it to layouts to ensure it's available for users to check or uncheck on your user creation page. Adding a new field to all custom layouts is not a trivial exercise, believe me!
However, if you still want to go ahead with this, you should try a different approach. It looks very much to me as though you've taken inspiration from Andy Fawcett here:
https://andyinthecloud.com/2013/10/27/introduction-to-calling-the-metadata-api-from-apex/
You should see the IMPORTANT UPDATE section. The async Metadata API methods were deprecated some time ago, this is the pattern to follow now:
https://andyinthecloud.com/2014/08/14/apex-metadata-api-streamlined-and-simplified-for-summer14/
I'm new here so sorry if I'm missing something...
I'd like some help concerning SAS/AF, I'm looking to create a dynamic calendar, which means days are automatically displayed when the user goes through the years/months.
I created a dataset with the info I need to be displayed in the calendar :
%let fromDate = 31DEC2005;
%let toDate = 31DEC2016;
data calendar;
do date = "&fromDate"d to "&toDate"d;
DayOfWeek = put(date, downame3.);
Day = put(date, day.);
Month=month(date);
Year=year(date);
output;
end;
format
date date9.
;
run;
What I'd like to do is create a frame that looks like the Windows calendar we have for example, but I don't know what component is the best to use here : Push Button or Container Box ?
I created a class via SCL code called Calendar, though I'm new to SAS too so I'm sorry I don't know where to start from with the class... I want to dynamically set the days (1-31) in the boxes (coming from the data set "calendar" above), when the user goes through years/months.
The user goes through years/months by clicking on a "scroll control" then displays the days afterwards.
Thank you for helping !
EDIT : I've made the frame using some properties, here's a look :
calendar
So what I still need to do is put the days (1-31) in the Push Buttons (I guess it's possible to do that with SCL via the .label). There's one problem though with the Spin Boxes, the data is set manually by me, in the Combo Boxes, it's set from the Data set I've created, is there a way to keep the Spin Boxes and link it to the Data Set instead ? like a list or something ? Enlighten me please u_u
I am new to angularJS and now i would like to how to add the year from current date.
Let's say i can get the user DOB and i want to add the year+1.
I have tried by using,
$scope.userdob = $rootScope.user.dob;
$scope.userdob.add(1,'years');
but it's not working.
Can anyone help me to know about this logic with example ?
TIA..,
You should use .setDate() function to increment the days.
I created an angular example here http://codepen.io/heshamelghandour/pen/WwodMP
It looks like $rootScope.user.dob is an instance of moment from the moment.js library. I think your main problem is angular's change detection cannot detect when you mutate this instance. Because the instance remains the same but the internal underlying date value does change. Thus I'd suggest:
$scope.userdob = $rootScope.user.dob.clone().add(1,'years').valueOf();
That way angular will get a regular JavaScript Date object instead of a moment instance and it's change detection will work correctly.
FYI to accomplish the same with a standard javascript Date instance you can do:
var userdob = new Date();
userdob.setYear(userdob.getFullYear() + 1)
To advance the year by 1.
Use .setDate() function to increment the days and instead of +1 day and add +365 days it will give you date after 1 year.
I have problem with richfaces calendar. I want to see only year and month so i made datePattern="yyyy/MM", which works fine until i want to change date.
When i click on button and calendar pop up the current value disappear. If i don't select date the value is null. I tried to save old date in my bean but problem remains because when i open calendar it is always set to todays date.
Problem occur only when i don't put dd(days) in datePatern
<rich:calendar value="#{myBean.date}" datePatern="yyyy/MM" />
Tnx for help in advance
I got answer on richfaces forum so i will copy it also here
I guess rich:calendar is not the right choice at you case although rich:calendar may be bound to probably any object type provided that you supply custom converter a day ordinal still should be supplied because it's a part of the date maybe you would do better with a h:selectOneMenu to specify a month and a h:inputText to define a year instead of "incomplete" rich:calendar