I want to initialize and destroy datepicker in materializecss. I know how to initialize but unable to find it how to destroy.
I have one textbox and one dropdown.based on dropdown, the textbox type is changed. so when user select dob, I initialized textbox with materializecss datepicker but after that I am not able to change textbox back to its normal mode, I mean where user can insert text or number.
I am using below code to initialize -
$('#txtDatePicker').pickadate({
selectMonths: true, // Creates a dropdown to control month
selectYears: 100 // Creates a dropdown of 15 years to control year
});
A datepicker usually has 3 buttons, however if these buttons are initialized without values ie. today: "" they will not be shown.
$('.datepicker').pickadate({
today: '',
clear: 'Clear selection',
close: 'Cancel'
});
For more information see: http://amsul.ca/pickadate.js/date/#buttons
From your comment
so lets say you have initialized date picker and now I want to destroy it, so that simple text can be written into it.
I think that if you only need a simple text can be written into it. Just add an option like this
$('.datepicker').pickadate({
editable: true
});
Related
I have requirement that sap.m.DatePicker should prevent alphabets but accept numbers. And the maximum input length should be 10.
When two digits entered for date, e.g. "10", a dot (".") should be automatically added. Also month. At the end, it should look like "10.12.2019" in DatePicker. I guess it would be possible with liveChange event, but DatePicker doesn't have liveChange.
Please let me know how to add custom liveChange event in DatePicker. It would be great help.
Currently (as of SAPUI5 1.64), there is no event such as liveChange for DatePicker. To add this functionality, you can create your own control and let it extend DatePicker. Then add the control to your view, attach an event handler and update the DatePicker's value using DatePicker#setValue.
You can take a look at
how to create a custom control in SAPUI5 here.
the liveChange implementation of sap.m.Input here.
The maxLength property of the input will be set by SAPUI5 automatically if you specify the DatePicker's property displayFormat, in your case dd.MM.yyyy.
OpenUI5/SAPUI5 1.104 adds the liveChange event to the following controls:
sap.m.DateTimeField controls, e.g.:
sap.m.DatePicker
sap.m.DateTimePicker
sap.m.DateRangeSelection
sap.m.TimePicker
sap.m.MaskInput
See commit: 72fdbf4.
I am trying to add static "Training"-events using a button located in a modal.
So what should happen: Clicking on a day or a range of days in fullcalendar opens a modal. In this modal a button is available to "add a training event".
I am using this modal because it shall be possible to add other events in future. Not just trainings.
The modal opens fine and clicking the button adds a new entry in fullcalendar. Clicking on a further day opens the modal again. If now the "add a training button" is clicked again, the new event is rendered twice. One event is rendered on the day i have clicked in the first step, the second is rendered at the day i have clicked now.
Step1:
clicking a day opens the modal
Step2:
clicking the button in the modal adds a new entry
Step3: repeating step1 on another day
Step4:
clicking the button again renders the event twice
Image: Step1-4
This is my js-code. What i am doing wrong?
var calendar = $(calendar).fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultDate: new Date(),
navLinks: true, // can click day/week names to navigate views
selectable: true,
selectHelper: true,
select: function (start, end) {
$('#fc_create').click(); // opens modal
$('.addTraining').on("click", function () { // clicking "add training button"
var eventData;
eventData = {
title: "Training",
start: start,
end: end
};
$('#calendar').fullCalendar('renderEvent', eventData);
$('.close').click();
})
},
editable: true,
eventLimit: true
});
Every time your "select" callback runs, you are adding another new "click" event handler to the "addTraining" element(s). So if "select" runs 3 times, then the "click" event will be declared 3 times, and when "addTraining" is clicked, 3 versions of the same code will run. Javascript allows multiple handlers for the same event to be attached to an element at once, so you are just building them up each time the "select" callback runs, without ever removing them.
To fix this you can either:
1) Declare the handler once - do it page load, outside your fullCalendar declaration. This will give you a problem in that you won't have direct access to the "start"/"end" values from the select callback. You can get round this by using global variables (yuck) or perhaps putting the values in hidden fields or data- attributes somewhere suitable, and then the click handler can find them each time it runs.
2) Using jQuery's "on" and "off" syntax to first remove the previous handler, and then add a new one, so only one handler is ever active at any one time. See http://api.jquery.com/off/ and http://api.jquery.com/on/ for more details and examples. I can provide a sample if necessary.
HI i am having an issue with drop down in ax 2012, i have 5 classes and i display them in the dropdown using their displaynames(i.e lookup of classes), but when i select on one of them and again click on dropdown the current value is not highlighted or cursor is not present on that value, cursor always points to the first value when i press drop down, it is not likely with the other dropdown in ax like enums the current value is highlighted when i press dropdown, please help me in resolving this issue thanks in advance.
dont have any data source on the form i am using edit method and lookup method for drop down here is the code i used please help me in solving this issue.
public void lookup()
{
List entityList;
entityList = CsSysClassUtil::getImplementedClasses(classStr(CsPsqIInstructNavigator));
CsSysClassUtil::createLookUp(this, entityList);
}
// this will display the selected value from the lookup in the field
public edit ClassName editProdOrderSearchDirection(
boolean _set,
ClassName _searchDirectionClassName)
{
if (_set)
{
if (CsSysClassUtil::validateInterface(
_searchDirectionClassName,
classnum(CsPsqIInstructNavigator),
CsSysMessageType::Info))
{
gProdOrderSearchDirection = _searchDirectionClassName;
}
}
return CsSysClassUtil::getClassDisplayName(className2Id(gProdOrderSearchDirection));
}
But when i again press the drop down the cursor is not highlighting the selected value or current value. its always high lighting the first value in the drop down. I want to high light the current value when drop down is clicked.(like it behaves with standard look up or enum look up)
following is the link for image of dialog
http://screencast.com/t/BNF6n3DkxKMc
In the above screen we can see value in the Search in (text control) is 'Next production order', but when drop down is clicked its highlighting 'current production order', i want to highlight 'Next production order' i.e value in the text control must be highlighted.
You can call findValue on the FormDataSource.
FormDataSource fds = _form.dataSource(1);
fds.findValue(fieldNum(_table_, _field_), this.valueStr());
Im trying to cut down on the clutter of my form since the data im getting can fill in more or less fields from my table.
as of right now im trying to build an event but I do not know the right syntax to use to create my event.
right now i have:
= if toggle.onclick ="yes" then
data.visible=true
else
data.visible=false
end if
in the After Update tab of the Event tab.
I hope that gives you an idea of what im trying to do.
I have this on a test form so the only objects are:
checkbox name "toggle"
textbox name "data"
the text box is default to not visible at the moment.
my goal is to have a list of check boxes and once they are checked their corresponding text box would appear on a refresh. this way the workers wont be intimidated by the amount of textboxes are on my current form. also will reduce the vast clutter on the current form.
By default, the 'Toggle' value will be True or False - not 'yes' or 'no'. Thus the following is what you need to toggle fields:
Private Sub Toggle_AfterUpdate()
If Me.Toggle = True Then
Me.Data.Visible = True
Else
Me.Data.Visible = False
End If
End Sub
I have a situation here: I have a form field with trigger xtype, what I want to happen on my trigger function is to open a window with a list or grid of data in it. I want to get the value of those data and assign it as the value of my form field with trigger. Can anyone help me solve this problem. Thank you very much.
You have multiple solutions for this.
You can make use Saki's simple message bus to do the communication between extjs components.
You can create an custom event for your trigger field. When user selects a record in your window, fire the event with the selected record.
Inside your onTriggerClick :
Display your window with grid / view for user selection
Inside your Window (on some submit button):
onSubmitClick: function(){
// Get the selected record & fire event
var selected = grid.getSelectionModel().getSelected();
triggerFieldObject.fireEvent('recordSelect',selected);
}
Inside your event processing (Will be on TriggerField):
onRecordSelect: function(record) {
// Now you have access to the selected record.. process it,
// Set the trigger field value etc
this.setValue('Your Value for Trigger Field');
}
Note: This is a skeleton code and not a complete solution. You will need to add your code according to your requirements.