Posted 6 December 2024, 6:22 am EST
- Updated 6 December 2024, 6:27 am EST
Hi,
Based on my understanding, you want to disable the date-time picker for specific cells, preventing it from opening for those cells.
Although there is no direct API to achieve this, you can override the openDateTimePicker command, which is responsible for opening the date-time picker. When overriding, the options parameter provides details such as the row, column, and sheet name. Using this information, you can decide whether to call the original openDateTimePicker command or block it based on your logic.
Refer to the snippet below, along with the attached GIF “Steps.gif” and the sample “Sample.zip”:
let oldOpenDateTimeCmd = GC.Spread.Sheets.Commands.openDateTimePicker.execute;
GC.Spread.Sheets.Commands.openDateTimePicker.execute = function () {
let options = arguments[1];
// Open the date-time picker only for even-numbered rows in column 5
if (options.row % 2 === 0 && options.col === 5) {
return oldOpenDateTimeCmd.apply(this, arguments);
}
return false;
};
Gif:
Sample: Sample.zip
References:
Regards,
Priyam