MonthPicker is a type of drop-down cell style in SpreadJS. Using JavaScript code, the developer can define a starting year, ending year, and height of the Month Picker. When set as a style on a cell in the workbook, the user can click on the drop-down arrow to select a month that will be displayed in that cell. An example of this drop-down is 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 Month Picker.
You can use MonthPicker drop-down with the following code :
// The way of click the dropdown icon to open MonthPicker.
var monthPickerStyle = new GC.Spread.Sheets.Style();
monthPickerStyle.cellButtons = [
{
imageType: GC.Spread.Sheets.ButtonImageType.dropdown,
command: "openMonthPicker",
useButtonStyle: true,
}
];
monthPickerStyle.dropDowns = [
{
type: GC.Spread.Sheets.DropDownType.monthPicker,
option: {
startYear: 2009,
stopYear: 2019,
height: 300,
}
}
];
sheet.setText(1, 5, "Month Picker");
sheet.setStyle(2, 5, monthPickerStyle);
// The way just open MonthPicker with command rather then clicking the dropdown button.
spread.commandManager().execute({cmd:"openMonthPicker",row:2,col:11,sheetName:"Sheet1"});
There are several item in options that can customize the MonthPicker.
Submit and view feedback for