📄 cycleitem.js
字号:
/*
* Isomorphic SmartClient
* Version 6.5 (2008-04-30)
* Copyright(c) 1998-2007 Isomorphic Software, Inc. All rights reserved.
* "SmartClient" is a trademark of Isomorphic Software, Inc.
*
* licensing@smartclient.com
*
* http://smartclient.com/license
*/
//> @class CycleItem//// Form item that iterates through a set of options in response to the user clicking.//<// Leave internal for now - we will expose synthetic checkbox and radioItem subclasses insteadisc.defineClass("CycleItem", "FormItem");isc.CycleItem.addProperties({ canSelectText:false, canFocus:true, // V-Align the cycleItem (checkboxes, etc) in the center - this looks best for the (default) // case where the height of the checkboxItem exceeds the height of the media iconVAlign:"middle"});isc.CycleItem.addMethods({ // On Space or Enter keypress, advance the value handleKeyPress : function () { var key = isc.EH.getKey(); if (key == "Space") { this.advanceValue(); // returning false kills native behavior (such as scrolling on space) return false; } return this.Super("handleKeyPress", arguments); }, // on click, advance the value handleClick : function () { if (this.isDisabled()) return; if (!isc.Browser.isIE) this.focusInItem(); this.advanceValue(); }, // This method will advance the value - selects the next option from this item's valueMap advanceValue : function () { var valueMap = this.getValueMap(); if (isc.isA.Object(valueMap) && !isc.isA.Array(valueMap)) { valueMap = isc.getKeys(valueMap); } if (valueMap == null || valueMap.length < 2) { this.logInfo("CycleItem is non interactive as there are no options for this item."); return; } var value = this.getValue(), index = valueMap.indexOf(value); if (index == valueMap.length -1) index = -1; // Call saveValue rather than setValue() so our change etc handler fires var newValue = valueMap[index+1]; if (!this.compareValues(newValue, this._value)) { var displayValue = this.mapValueToDisplay(newValue); this.setElementValue(displayValue, newValue); // use "updateValue" to actually save the value out. This should handle // firing change() / changed() handlers, validation, etc. this._updateValue(newValue); } }});
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -