TimePicker is a drop-down in SpreadJS that can be defined in JavaScript code with the style properties. This drop-down shows a different selection of times, which the developer specifies in terms of minimum, maximum, and step. This gives developers the ability to add a simple time picker to their workbook, which can be useful for creating user input forms. An example of the two different ways to display the time in the TimePicker are shown in the spreadsheet below.
Drop-downs provide a developer the ability to add a drop-down menu with specific properties to cells in a workbook. These drop-down menus don't require any extra code other than simply specifying which one to use for the drop-down menu.
SpreadJS has 9 different kinds of drop-downs, and this demo shows how to use the Time Picker.
You can use the Time Picker drop-down with the following code :
// The way of click the dropdown icon to open TimePicker.
var timePickerStyle = new GC.Spread.Sheets.Style();
timePickerStyle.cellButtons = [
{
imageType: GC.Spread.Sheets.ButtonImageType.dropdown,
command: "openTimePicker",
useButtonStyle: true,
}
];
timePickerStyle.dropDowns = [
{
type: GC.Spread.Sheets.DropDownType.timePicker,
option: {
min: { hour: 8 },
max: { hour: 19 },
step: { minute: 30 },
formatString: "h:mm AM/PM",
}
}
];
sheet.setText(1, 5, "Time Picker");
sheet.setStyle(2, 5, timePickerStyle);
// The way just open TimePicker with command rather then clicking the dropdown button.
spread.commandManager().execute({cmd:"openTimePicker",row:2,col:5,sheetName:"Sheet1"});
There are also some option items for customizing the TimePicker:
Submit and view feedback for