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

📄 actionmethods.js

📁 javascript 很酷的类库
💻 JS
📖 第 1 页 / 共 3 页
字号:
                    this.fieldValuesAreEqual(field, currentValues[i], submittedValues[i]))                 {                    this.setValue(i, data[i]);                }            }        }                this._callbackState = {            request: request,            response: response,            data: data        };        this.formSavedComplete();    },        // notify every FormItem that the form has finished saving.  Used to allow items such as    // the MultiFileItem to save records which are related a newly created record created by    // saving of the main form.    formSavedComplete : function () {        var fields = this.getFields();        for (var i = this._formSavedIndex; i < fields.length; i++) {            this._formSavedIndex++;            var field = fields[i];            // call formSaved on the formItem, if defined.  If formSaved() returns false, that            // means it's going to do some async processing and call this method again when            // complete.            if (isc.isA.Function(field.formSaved) &&                 field.formSaved(this._callbackState.request, this._callbackState.response,                                 this._callbackState.data) === false) return;        }        // the _userCallback is the original callback specified by the user to saveData().        // Once we've completed all formSaved() calls, call the user back.        if (this._userCallback) {            this.fireCallback(this._userCallback, "dsResponse,data,dsRequest",                                             [this._callbackState.response,                                             this._callbackState.data,                                             this._callbackState.request]);        }        delete this._userCallbackState;        delete this._userCallback;    },    	// save the given values, displaying any server-side validation errors in the given editor	saveEditorValues : function (values, saveOperation, callback, context) {                var undefined;		if (!context) context = {};		isc.addProperties(context, {			prompt:(context.prompt || isc.RPCManager.saveDataPrompt),			editor:this,			willHandleError:true		});        // valuesAsParams - also sends the DSRequest values as request parameters        if (context.valuesAsParams) {            if (!context.params) context.params = {};            isc.addProperties(context.params, values);        }    	var dataSource = this.getDataSource();        return dataSource.performDSOperation(                    saveOperation.type, values,                    callback ? callback : {target:this, methodName:"saveEditorReply"}, context);	},		// save the given values via direct submit, displaying any server-side validation errors in    // the given editor	submitEditorValues : function (values, saveOperation, callback, context) {				if (!context) context = {};		isc.addProperties(context, {            directSubmit : true,            submitForm : this        });        return this.saveEditorValues(values, saveOperation, callback, context);	},            // reply to the 'save editor' call	saveEditorReply : function (response, data, request) {        // error occurred: the presence of results.errors indicates it's a validation error,        // which we can handle.  XXX should really check for status == validation error constant		if (response.status == isc.RPCResponse.STATUS_VALIDATION_ERROR && response.errors) {			this.setErrors(response.errors, true);            return false; // return false to avoid the end user callback being called		}		// some error we weren't expecting occurred, bail with an error dialog		if (response.status < 0) return isc.RPCManager._handleError(response, request);        		return true;	},        _saveFormValidateCallback : function (rpcRequest, rpcResponse, data) {        if(rpcResponse.status == isc.RPCResponse.STATUS_SUCCESS) {            this.performingServerValidation = false;            this.markForRedraw("serverValidationSuccess");            this.saveData(rpcRequest._userCallback, rpcRequest._userProps, true);            rpcRequest._userCallback = null;            rpcRequest._userProps = null;        } else {            this.setErrors(rpcResponse.errors, true);        }    }    });if (isc.DynamicForm) isc.ClassFactory.mixInInterface("DynamicForm", "EditorActionMethods");// Overrides to existing methods on the DF classisc._EditorFlowOverrides = {    //>	@method DynamicForm.fetchData()    // Retrieve data that matches the provided criteria, and edit the first record returned    //     // @param [criteria]          (Criteria)	  search criteria    // @param [callback]          (DSCallback)  callback to invoke on completion    // @param [requestProperties] (DSRequest)   additional properties to set on the DSRequest    //                                            that will be issued    //    // @group dataBoundComponentMethods    // @visibility external    //<    fetchData : function (criteria, callback, requestProperties) {        var ds = this.getDataSource();        if (!ds) {            this.logWarn("Ignoring call to fetchData() on a DynamicForm with no valid dataSource");            return;        }        if (this._fetchDataCallbackArr == null) this._fetchDataCallbackArr = [];        this._fetchDataCallbackArr.add(callback);         ds.fetchData(criteria, {target:this, methodName:"fetchDataReply"}, requestProperties);    },        fetchDataReply : function (response, data, request) {        var record = data ? data.get(0) : null;        this.editRecord(record);        var callback = this._fetchDataCallbackArr.pop();        if (callback) this.fireCallback(callback, "dsResponse,data,dsRequest", [response,data,request]);    },        //>	@method DynamicForm.filterData()    // Retrieve data that matches the provided criteria, and edit the first record returned.<br>    // Differs from +link{DynamicForm.fetchData()} in that a case insensitive substring match    // will be performed against the criteria to retrieve the data.    //     // @param [criteria]          (Criteria)	  search criteria    // @param [callback]          (DSCallback)  callback to invoke on completion    // @param [requestProperties] (DSRequest)   additional properties to set on the DSRequest    //                                            that will be issued    //    // @group dataBoundComponentMethods    // @visibility external    //<        filterData : function (criteria, callback, requestProperties) {        var ds = this.getDataSource();        if (!ds) {            this.logWarn("Ignoring call to filterData() on a DynamicForm with no valid dataSource");            return;        }        if (this._fetchDataCallbackArr == null) this._fetchDataCallbackArr = [];        this._fetchDataCallbackArr.add(callback);         ds.filterData(criteria, {target:this, methodName:"fetchDataReply"}, requestProperties);    }}if (isc.DynamicForm) isc.DynamicForm.addMethods(isc._EditorFlowOverrides);//>ValuesManagerif (isc.ValuesManager) isc.ClassFactory.mixInInterface("ValuesManager", "EditorActionMethods");if (isc.ValuesManager) isc.ValuesManager.addMethods(isc._EditorFlowOverrides);// Pick up fieldValuesAreEqual from the DataBoundComponent methods.if (isc.ValuesManager) {    isc.ValuesManager.addProperties({        // apply the standard fieldValuesAreEqual method to ValueMaps as well as Canvii        fieldValuesAreEqual:isc.Canvas.getPrototype().fieldValuesAreEqual    })}// Add JSDocs to the ValuesManager as well as the DynamicForm// NOTE: filterData/clearCriteria are not documented because they are just// convenience relative to summary.filterData/clearCriteria, and it's confusing/distracting// for them to have the same names.   However these two methods were exposed briefly in// 5.1. //>	@method valuesManager.doExport()// @include dynamicForm.doExport()//<//>	@method valuesManager.editNewRecord()// @include dynamicForm.editNewRecord()//<//>	@method valuesManager.editRecord()// @include dynamicForm.editRecord()//<   //>	@method valuesManager.editSelectedData()// @include dynamicForm.editSelectedData()//<//>	@method valuesManager.saveData()// @include dynamicForm.saveData()//<//>	@method valuesManager.submit()// @include dynamicForm.submit()//<//>	@method valuesManager.cancel()// @include dynamicForm.cancel()//<//> @method valuesManager.filterData()// @include dynamicForm.filterData()//<//> @method valuesManager.fetchData()// @include dynamicForm.fetchData()//<//<ValuesManagerif (isc.TreeGrid) {isc.TreeGrid.addMethods({    // TreeGrid.fetchData() / filterData() documented in DataboundComponent.js            _filter : function (type, criteria, callback, requestProperties) {        if (type == null) type = "fetch";                //>!BackCompat 2005.3.21 old signature: criteria, context        if (requestProperties == null && isc.isAn.Object(callback) &&             callback.methodName == null)         {            // old style call, second param (callback) is really requestParams            requestProperties = callback;            callback = null;        } //<!BackCompat        this.setData(this.createResultTree(criteria, callback, requestProperties, type));    }    });}// DETAIL VIEWING// --------------------------------------------------------------------------------------------if (isc.DetailViewer) {    isc.DetailViewer.addMethods({    //>	@method detailViewer.viewSelectedData()    //    // Displays the currently selected record(s) of the selectionComponent widget (typically a    // listGrid) in the detailViewer.    //    // @param selectionComponent (ListGrid or ID)    //     the ListGrid or ID of a +link{ListGrid} whose currently selected    //     record(s) is/are to be edited    //    // @group dataBoundComponentMethods    // @visibility external    //<    // NOTE: technically, application.viewSelected() has a case where it will issue a DSRequest    // to fetch the full set of fields, but we don't expose the capability to have a ListGrid    // load less than the full set of fields right now.    // @param [callback]         (DSCallback)    callback to invoke on completion    // @param [requestProperties] (DSRequest)     additional properties to set on the    //                                             DSRequest that will be issued    viewSelectedData : function (selectionComponent, callback, requestProperties) {                // support being passed an ID        if (isc.isA.String(selectionComponent)) selectionComponent = window[selectionComponent];            requestProperties = requestProperties || {};                var selection = selectionComponent.selection.getSelection();        if (selection && selection.length > 0) {                        // if we're not passed an operation, simply show the records from the selection in the            // viewer            if (!requestProperties.operation) {                this.setData(selection);	                                    } else {                    // We were passed an operation - perform it to get the record back from the server.                // This would be required if (for example) the selection components operation is                 // only getting a subset of fields                                // reduce the recordList to just the primary keys                var operation = requestProperties.operation,                    dataSource = this.getDataSource(),                    keys = dataSource.filterPrimaryKeyFields(selection);                                if (requestProperties.prompt == null)                     requestProperties.prompt = isc.RPCManager.getViewRecordsPrompt;                requestProperties.viewer = this;                                // actually perform the relevant operation                       return dataSource.performDSOperation(                                            operation.type, keys,                                             (callback ? callback : {target:this, methodName:"viewSelectedDataReply"}),                                             requestProperties                        );            }        }        return false;               },        //>!BackCompat 2004.7.23    viewSelected : function (selectionComponent, context) {         return this.viewSelectedData(selectionComponent, context)    },    //<!BackCompat        // handle a reply from the viewSelectedData call	viewSelectedDataReply : function (response, data, request) {		this.setData(data);	}    });}

⌨️ 快捷键说明

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