📄 picklist.js
字号:
// If specified this color will be applied to the text of hilighted rows in the pickList, // when the user rolls over them. This color will be applied on top of the "over" CSS Style // specified by <code>pickListBaseStyle</code> //< //pickListHiliteTextColor:null, // autoSizePickList // If true the pick list will expand horizontally to accomodate its widest item. // Not supported for databound lists (since the items load incrementally) //autoSizePickList : false, //>Animation //> @attr PickList.animatePickList (boolean : null : IRWA) // If true, when the pickList is shown, it will be shown via an animated reveal effect // @visibility animation //< //> @attr PickList.animationTime (number : 200 : IRWA) // If this.animatePickList is true - this specifies the duration of the animation effect // applied when showing the pickList // @visibility animation //< pickListAnimationTime:200, //<Animation //> @attr PickList.fetchDelay (number : 200 : IRWA) // Delay in ms between a call to fetch the data for this picklist and kicking the call off // to the server. Only applies to databound pickLists. If multiple fetch calls are made // made within this fetch delay, only the most recent fetch will actually be sent to the // server //< fetchDelay:200, //>@attr PickList.pickListCellHeight (number : 16 : IRW) // Cell Height for this item's pickList. //< pickListCellHeight:16, // Allow low-level overriding of pickList properties //> @attr PickList.pickListProperties (object : null : IR) // If specified this properties block will be applied to the pickList created for this // Form Item. // @visibility external //< //pickListProperties : null, //> @attr PickList.pickListHeaderHeight (number : 22 : IRW) // If this pick list is showing multiple fields, this property determines the height of // the column headers for those fields. Set to zero to suppress the headers entirely. // @see pickListFields // @visibility external //< pickListHeaderHeight:22 // -------------------------------------------------------------------------------------- // Data / databinding //> @attr PickList.valueField (string : null : IRA) // @include FormItem.valueField //< //> @attr PickList.displayField (string : null : IRW) // @include FormItem.displayField //< //> @attr PickList.pickListFields (Array : null : IRA) // This property allows the developer to specify which field[s] will be displayed in the // drop down list of options. // <P> // Only applies to databound pickLists (see +link{PickList.optionDataSource}, or picklists // with custom data set up via the advanced +link{pickList.getClientPickListData()} method. // <P> // If this property is unset, we display the +link{PickList.displayField}, if specified, // otherwise the +link{PickList.valueField}<br> // // If there are multiple fields, column headers will be shown for each field, the // height of which can be customized via the +link{pickList.pickListHeaderHeight} attribute. // @see valueField // @see pickList.pickListHeaderHeight // @visibility external //< //> @attr PickList.valueIconField (string : null : IRWA) // For Databound formItems, this property determines which column // +link{formItem.valueIcons} should show up in for this formItem's pickList.<br> // If unset valueIcons show up in the +link{pickList.displayField} column if specified, // otherwise the +link{pickList.valueField} column.<br> // In most cases only the <code>displayField</code> or <code>valueField</code> will be visible. // This property is typically only required if custom +link{PickList.pickListFields} // have been specfied for this item. // @see FormItem.valueIcons // @see PickList.pickListFields // @visibility external //< //> @attr PickList.pickListCriteria (Criteria : null : IRWA) // If this item has a databound pick-list (for example +link{PickList.optionDataSource} is // set) this property can be used to provide static filter criteria when retrieving the data // for the pickList. // @visibility external //< //> @attr PickList.optionDataSource (DataSource | String : null : IRA) // If set, this FormItem will derive data to show in the PickList by fetching records from // the specified <code>optionDataSource</code>. The fetched data will be used as a // +link{formItem.valueMap,valueMap} by extracting the // +link{formItem.valueField,valueField} and +link{formItem.displayField,displayField} in // the loaded records, to derive one valueMap entry per record loaded from the // optionDataSource. Multiple fields from the fetched data may be shown in the pickList by // setting +link{pickListFields}. // <P> // The data will be retrieved via a "fetch" operation on the DataSource, passing the // +link{PickList.pickListCriteria} (if set) as criteria, and passing // +link{optionFilterContext} (if set) as DSRequest properties. // <P> // The fetch will be triggered when the pickList is first shown, or, you can set // +link{SelectItem.autoFetchData,autoFetchData:true} to fetch when the FormItem is // first drawn. You can also call +link{PickList.fetchData()} at any time to manually // trigger a fetch. // <P> // Data paging is automatically enabled if the optionDataSource supports it. As the // pickList is scrolled by the user, requests for additional data will be automatically // issued. // <P> // For a pickList attached to a ComboBoxItem, new fetches are issued as the user types, // with criteria set as described under +link{comboBoxItem.getPickListFilterCriteria()}. // If your dataSource is not capable of filtering results by search criteria (eg the // dataSource is backed by an XML flat file), you can set +link{filterLocally} to have the // entire dataset loaded up front and filtering performed in the browser. This disables // data paging. // <P> // Setting optionDataSource also enables the basic +link{FormItem.optionDataSource} // behaviors, eg, fetching individual display values before the pickList is shown. // <P> // Note that if a normal, static +link{formItem.valueMap,valueMap} is <b>also</b> specified // for the field (either directly in the form item or as part of the field definition in // the dataSource), it will be preferred to the data derived from the optionDataSource for // whatever mappings are present. // // @visibility external //< //> @attr PickList.showOptionsFromDataSource (boolean : null : IRWA) // If this item is part of a databound form, and has a specified <code>valueMap</code> // by default we show the valueMap options in the pickList for the item. // Setting this property to true will ensure that the options displayed in our pickList // are derived from the form's <code>dataSource</code>. // @group databinding // @visibility external //< //> @attr PickList.optionFilterContext (RPCRequest Properties : null : IRA) // If this item has a specified <code>optionDataSource</code>, and this property is // not null, this will be passed to the datasource as +link{rpcRequest} properties when // performing the filter operation on the dataSource to obtain the set of options for the // list. // @visibility external //< // This gives the developer the option of specifying (for example) an operation name. //> @attr PickList.filterLocally (boolean : false : IRA) // If <code>filterLocally</code> is set for this item, and this item is showing options // from a dataSource, fetch the entire set of options from the server, and use these values // to map the item value to the appropriate display value. Also use <code>"local"</code> // type filtering on drop down list of options.<br> // This means data will only be fetched once from the server, and then filtered on the // client. // @see FormItem.filterLocally // @visibility external //< //> @attr PickList.filterDisplayValue (boolean : null : IRA) // When performing the filter on the data displayed in the pickList, for valueMapped fields, // should the filter criteria be compared to the raw data values in the source list, or the // values mapped to display. // This setting only has an effect on non-databound pick lists // @visibility internal //< });isc.PickList.addInterfaceMethods({ // showPickList // API to be called by the form item when the pickList is to be shown // Note that positioning of the pickList can should be set up by modifying // getPickListPosition(). // If 'waitForData' is passed, don't show the list until the filter completes. showPickList : function (waitForData, queueFetches) { // Set a flag to note that we've started to show the pickList. this._showingPickList = true; // Only pass in the param to show when the filter is complete if we're waiting for // data - otherwise we'll show the pickList explicitly (below). if (!this.pickList) this.makePickList(waitForData); // This will ensure the pickList is associated with this form item and set up its // data and fields. else this.setUpPickList(waitForData, queueFetches); // call _showPickList to actually show the pickList. if (!waitForData && (!this.pickList.isDrawn() || !this.pickList.isVisible())) { this._showPickList(); } }, // Actually show the pick list. on the page. _showPickList : function () { // don't show the PL if it's got no data // also don't show if we're not drawn - this can happen if we're showing in response // to an asynch event like fetching data. var list = this.pickList; if (list.getTotalRows() < 1 || !this.isDrawn()) return; //this.logWarn("showing pickList: " + this.getStackTrace()); if (!list.isDrawn()) { list.visibility = isc.Canvas.HIDDEN; var width = this.pickListWidth != null ? this.pickListWidth : this.getElementWidth(); list.setWidth(width); list.draw(); } this.placePickList(); if (!list.isDrawn() || !list.isVisible()) { //>Animation // Show, or animate-show if (this.animatePickList) this.pickList.animateShow("wipe", null, this.pickListAnimationTime); else //<Animation this.pickList.show(); } }, //>@method PickList.fetchData() // Only applies to databound items (see +link{PickList.optionDataSource}).<br> // Performs a fetch type operation on this item's DataSource to retrieve the set of valid // options for the item, based on the current +link{PickList.pickListCriteria}. // @param callback (callback) Callback to fire when the fetch completes. Callback will // fire with 2 parameters: <code>item</code> a pointer to the form item and // <code>dsResponse</code> the +link{dsResponse} returned by the server. // @param requestProperties (dsRequest properties) properties to apply to the // dsRequest for this fetch. // @visibility external //< // @param maintainCache (boolean) By default when this method is called we drop any // cached rows and re-fetch. Pass in this parameter to suppress this behavior. // Note that if the fetch operation does not hit the server (which will occur // if the data is already cached), the callback will not fire fetchData : function (callback, requestProperties, maintainCache) { if (this.getOptionDataSource() == null) { this.logWarn("fetchData() called for a non-databound pickList. Ignoring"); return; } // Store the callback passed in on the request's clientContext object. // This will be picked up as part of filterComplete() if (callback != null) { if (requestProperties == null) requestProperties = {}; if (requestProperties.clientContext == null) requestProperties.clientContext = {}; requestProperties.clientContext._callback = callback; } if (!this.pickList) this.makePickList(false, requestProperties); else this.filterDataBoundPickList(requestProperties, !maintainCache); }, // Create the pickList for this widget. makePickList : function (show, request) { //>DEBUG var startTime = isc.timeStamp(); //<DEBUG // Wherever possible, we reuse picklist menus across multiple items // If explicit pickListProperties have been specified for this item, use a uniqe // pickList instead - this avoids us having to correctly apply (and then clear) freeform // properties to a shared pickList object // If we're databinding we cache picklists on a per-datasource basis. // If the datasource, and the specified set of fields match we reuse the list - otherwise // create a new one (rather than re-binding) var reusePickList = this.reusePickList(); if (this.reusePickList()) { this.pickList = this.getSharedPickList();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -