⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 detailviewer.js

📁 javascript 很酷的类库
💻 JS
📖 第 1 页 / 共 2 页
字号:
/*
 * 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	DetailViewer////  Displays one or more records "horizontally" with one property per line.////  @implements DataBoundComponent    //  @treeLocation Client Reference/Grids//  @visibility external//<isc.ClassFactory.defineClass("DetailViewer", "Canvas");// add default propertiesisc.DetailViewer.addProperties({    // Data	// --------------------------------------------------------------------------------------------        //>	@attr	detailViewer.data		(Array of DetailViewerRecord : null : IRW)    // A single record object or an array of them, specifying data. Note that DetailViewers do    // not observe changes to the data array (in other words they will not automatically    // re-draw when the data provided via this property is altered).    //    // @group basics    // @visibility external    //<        //> @object DetailViewerRecord    //     // A DetailViewerRecord is an object literal with properties that define the values for the    // various fields of a +link{DetailViewer}.    // <p>    // For example a DetailViewer that defines the following fields:    // <pre>    // fields : [    //     {name: "field1"},    //     {name: "field2"}    // ],    // </pre>    // Might have the following data:    // <pre>    // data : [    //     {field1: "foo", field2: "bar"},    //     {field1: "field1 value", field2: "field2 value"}    // ]    // </pre>    // Each element in the data array above is an instance of DetailViewerRecord - notice that    // these are specified simply as object literals with properties.    //    // @treeLocation Client Reference/Grids/DetailViewer    // @visibility external    //<    // Fields    // ---------------------------------------------------------------------------------------    //>	@attr	detailViewer.fields		(List of DetailViewerField : null : IRW)    //     // An array of field objects, specifying the order and type of fields to display in this    // DetailViewer.  In DetailViewers, the fields specify rows.     //    // @visibility external    //<    //> @object DetailViewerField    //    // An object literal with a particular set of properties used to configure the display of    // and interaction with the rows of a +link{DetailViewer}.    //    // @treeLocation Client Reference/Grids/DetailViewer    // @visibility external    //<    //> @method detailViewerField.showIf    //     // If specified on a field, this method is evaluated at draw time to determine whether or    // not to show this particular field.    // <p>    // This method can be specified either as a function or a string that will be    // auto-converted to a function.    //    // @param viewer (DetailViewer) The DetailViewer    // @param valueList (List of DetailViewerRecord)     //    // @return (boolean) true to show the field, false to not show it.    //     // @visibility external     //<    //> @attr detailViewerField.type (String : null : IR)    //     // Specifies the type of this DetailViewerField.  By default (value is <code>null</code>)    // the field shows a field title on the left and the field value on the right.  There are    // two special values for this attribute:    // <ul>    // <li>"header" - If you specify type "header", the field spans both the field name and    // field value columns and contains text defined in the +link{DetailViewerField.value}    // attribute with the style specifed by +link{DetailViewer.headerStyle}.  You can use this    // field type as a titled separator.    // <li>"separator" - If you specify type "separator", the field spans both the field name    // and the field value columns with no text, and is styled using the style specified via    // +link{DetailViewer.separatorStyle}.  The height of the separator field can be controlled    // via +link{DetailViewerField.height}.    // </ul>    //     // @visibility external     //<    //> @attr detailViewerField.title (HTML : null : IR)    //     // The title of the field as displayed on the left-hand side.  If left unspecified, the    // title of the field is derived by looking up the value of    // +link{DetailViewer.fieldIdProperty} on this field.  So, by default, the title of a field    // is the value of its "name" property.    //    // @see DetailViewer.fieldIdProperty    // @visibility external     //<    //> @attr detailViewerField.valueMap (object : null : IR)    //    // A property list (or an expression that evaluates to a property list)	// specifying a mapping of internal values to display values for the field (row).    //    // @visibility external     //<    // XXX not exposing for now - refactor as formatters a-la ListGrid?    //> @attr detailViewerField.asHTML (boolean : null : IR)    //    // Escapes value via String.asHTML().    //    // @visibility internal     //<    //> @attr detailViewerField.value (HTML : "undefined" : IR)    //    // When a field specifies its +link{detailViewerField.type} to be "header", the value of    // this attribute specifies the header text.     //    // @visibility external     //<        //> @attr detailViewerField.width (Number : null : IR)    //     // @visibility internal     //<    //> @attr detailViewerField.height (Number : null : IR)    //     // For +link{DetailViewerField.type}: <code>"separator"</code>, this attribute specifies    // the height of the separator.    //     // @visibility external     //<    //>	@attr	detailViewer.fieldIdProperty (string : "name" : IRWA)	// Name of the field in the DetailViewerRecord which specifies the data property for that record.    // @visibility external	//<	fieldIdProperty:"name",		    // Multi-record display	// --------------------------------------------------------------------------------------------    //>	@attr	detailViewer.recordsPerBlock		(number : 1 : [IRW])    //          The number of records to display in a block. A block is a horizontal row on a page    //          containing one or more records, as specified by the value of recordsPerBlock. The    //          height of a block is equal to the height of a single record. The default setting of    //          1 causes each record to appear by itself in a vertical row. Setting recordsPerBlock    //          to 2 would cause records to appear side by side in groups of two.    //          Use a value of "*" to indicate all records.    // @group appearance    // @visibility external    //<	recordsPerBlock:1,    //>	@attr	detailViewer.blockSeparator		(string : "<BR><BR>" : [IRW])    // A string (HTML acceptable) that will be written to a page to separate blocks.    // @group appearance    // @visibility external    //<	blockSeparator:"<BR><BR>",    // Empty values	// --------------------------------------------------------------------------------------------        //>	@attr	detailViewer.showEmptyField		(boolean : true : IRWA)	// Whether to show the field when the value is null    // @group appearance    // @visibility external	//<	showEmptyField:true,    //>	@attr	detailViewer.emptyCellValue		(string : "&nbsp;" : IRWA)	// Text to show for an empty cell    // @group appearance    // @visibility external	//<	emptyCellValue:"&nbsp;",			    // Labels	// --------------------------------------------------------------------------------------------    //>	@attr	detailViewer.labelPrefix		(string : "" : IRW)	// text to put before a label    // @group labels    // @visibility external	//<	labelPrefix:"",						    //>	@attr	detailViewer.labelSuffix		(string : ":" : IRW)	// text to put after a label    // @group labels    // @visibility external	//<	labelSuffix:":",					    //>	@attr	detailViewer.wrapLabel		(boolean : false : IRW)	// Should the label be allowed to wrap, or be fixed to one line no matter how long    // @group labels    // @visibility external	//<	// CSS styles	// --------------------------------------------------------------------------------------------    //>	@attr	detailViewer.labelStyle		(CSSStyleName : "detailLabel" : IRW)	//			CSS style for a normal detail label    // @group appearance    // @visibility external	//<	labelStyle:"detailLabel",		    //>	@attr	detailViewer.cellStyle		(CSSStyleName : "detail" : IRW)	//			CSS style for a normal value    // @group appearance    // @visibility external	//<	cellStyle:"detail",				    //>	@attr	detailViewer.headerStyle		(CSSStyleName : "detailHeader" : IRW)	//			CSS style for a header    // @group appearance    // @visibility external	//<	headerStyle:"detailHeader",		    //>	@attr	detailViewer.separatorStyle		(CSSStyleName : "detail" : IRW)	//			CSS style for a separator    // @group appearance    // @visibility external	//<	separatorStyle:"detail",			    //>	@attr	detailViewer.cellPadding		(number : 3 : [IRW])    //          The amount of empty space, in pixels, surrounding each detailViewer value in its    //          cell.    //<    // FIXME ditch in favor of CSS style per cell	cellPadding:3,        //>	@attr	detailViewer.showBorder		(boolean : true : IRW)	//	Should we show a border around the output	//<    // FIXME ditch in favor of CSS style for overall table	showBorder:true,		    //> @attr detailViewer.dateFormatter (DateDisplayFormat : null : IR)	// Display format to use for fields specified as type 'date'.  Default is to use the    // system-wide default normal date format, configured via    // +link{Date.setNormalDisplayFormat()}.  Specify any valid +link{type:DateDisplayFormat} to     // change the format used by this detailViewer.    // @visibility external     //<    	// Empty Message	// --------------------------------------------------------------------------------------------	//>	@attr	detailViewer.showEmptyMessage		(boolean : true : IRWA)	// Show +link{attr:detailViewer.emptyMessage} when there is no data to display?    // @see emptyMessage    // @group emptyMessage    // @visibility external	//<	showEmptyMessage:true,    //>	@attr	detailViewer.emptyMessage		(string : "No items to display." : IRW)    //          The string to display in the body of a detailViewer with no records.    // @group emptyMessage    // @visibility external    //<	emptyMessage:"No items to display.",        //>	@attr	detailViewer.emptyMessageStyle		(CSSStyleName : "normal" : IRWA)    // CSS style to display this message in    // @group emptyMessage    // @visibility external	//<	emptyMessageStyle:"normal",    //>	@attr	detailViewer.loadingMessage		(string : "&nbsp;" : IRW)    //          The string to display in the body of a detailViewer which is loading records.    // @group emptyMessage    // @visibility external    //<    loadingMessage:"&nbsp;",    //>	@attr	detailViewer.loadingMessageStyle		(CSSStyleName : "normal" : IRWA)    // CSS style to use for the +link{loadingMessage}.    // @group emptyMessage    // @visibility external	//<    loadingMessageStyle:"normal",    // ---------------------------------------------------------------------------------------    // About two values worth of data.   Keeps the DV from taking up the 100px default height    // without being unexpectedly small when it has no data.    defaultHeight:35 });// add methodsisc.DetailViewer.addMethods({//>	@method	detailViewer.initWidget()	(A)//			initializes the list of fields//			sets up the data (if specified)////		@param	[all arguments]	(object)	objects with properties to override from default//<initWidget : function () {	// call the superclass function	this.Super("initWidget",arguments);	// include any field data from a specified dataSource.	this.fields = this.bindToDataSource(this.fields);},//>	@method	detailViewer.setData()  ([])// Sets the data displayed by this detail viewer.////      @visibility external//		@param	newData		(object or array)	new data to be displayed//<setData : function (newData) {        // clear old observation    if (this.data) this.ignore(this.data, "dataChanged");	// remember the new data	this.data = newData;    if (this.data && this.data.dataChanged) {        this.observe(this.data, "dataChanged", "observer.markForRedraw()");    }    	// and mark the viewer as dirty so it'll be redrawn	this.markForRedraw("new data");},//>	@method	detailViewer.getData()	(A)//			return the data to be displayed////		@return	(Object)	data for this widget - either Object or Array//<getData : function () { return this.data; },//>	@method	detailViewer.getFields()	(A)//			return the list of fields to display////		@return	(List of DetailViewerField)	array of objects to display//<getFields : function () { return this.fields; },

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -