Reputation: 747
I want to add a datebox similar to the one in give link http://www.jeasyui.com/demo/main/index.php?plugin=DateBox&theme=default&dir=ltr&pitem= in my web aplication project(smartgwt).
In short I want the datebox(jquery) equivalent in smartGwt. when i googled i found out there is something called dateChooser in smartGwt but it works like a calendar i want something like the one in above link textfield with a button which on clicking displays the calendar and the selected date appears on the textbox.
please give any suggestions i am using smartGwt LGPL.
Upvotes: 0
Views: 2229
Reputation: 2219
You can use a DateItem with useTextField=true to get the required behavior.
DateItem dateItem2 = new DateItem();
dateItem2.setTitle("Date");
dateItem2.setUseTextField(true);
dateItem2.setHint("<nobr>Direct date input</nobr>");
Check 'Date Controls' section in http://www.smartclient.com/smartgwt/showcase/#form_controls_various.
DateItem is a FormItem, meaning you need to put it in a form, and will work just like other form controls.
DateChooser on the other hand is a standalone widget that you can embed among other widgets on its own.
Upvotes: 2
Reputation: 3368
I haven't seen such a component in smartgwt showcase but there is something called PickerIcon
which can be coupled to a TextItem
to achieve what you want.
PickerIcon datePicker = new PickerIcon(PickerIcon.DATE, new FormItemClickHandler() {
public void onFormItemClick(FormItemIconClickEvent event) {
SC.say("Date Picker clicked"); // or show a dateChooser component
}
});
TextItem datePickerControl = new TextItem("datePicker", "Date Picker");
datePickerControl.setIcons(datePicker);
http://www.smartclient.com/smartgwt/showcase/#form_category_picker_icons
Hope this can help !
Upvotes: 0