Differences

This shows you the differences between two versions of the page.

Link to this comparison view

easyquery:js:eq-client-ns [2015/07/27 12:32] (current)
Line 1: Line 1:
 +
 +====== EQ.client namespace ======
 +<jxd:nsSummary>Contains several functions which help initilize and manage EasyQuery widgets and simplify the communications with server-side code.</jxd:nsSummary>
 +
 +===== Functions =====
 +
 +
 +==== init ====
 +
 +<jxd:function>
 +<jxd:functionSummary>Initializes all EasyQuery objects and widgets.</jxd:functionSummary>
 +<jxd:params>
 +<jxd:param>
 +<jxd:paramName>options</jxd:paramName>
 +<jxd:paramType>Object</jxd:paramType>
 +<jxd:paramSummary>A map of options to pass to EasyQuery core objects and widgets.
 +By default all parameters are taken directly from easyQuerySettings global variable</jxd:paramSummary>
 +<jxd:props>
 +<jxd:prop>
 +<jxd:propName>serviceUrl</jxd:propName>
 +<jxd:propType>String</jxd:propType>
 +<jxd:propDefault>EasyQuery</jxd:propDefault>
 +<jxd:propSummary>an URL (absolute or relative) to the back-end service or controller which implements basic</jxd:propSummary>
 +</jxd:prop>
 +<jxd:prop>
 +<jxd:propName>modelName</jxd:propName>
 +<jxd:propType>String</jxd:propType>
 +<jxd:propSummary>the name of the data model which will be automatically during initialization;</jxd:propSummary>
 +</jxd:prop>
 +<jxd:prop>
 +<jxd:propName>columnsPanel</jxd:propName>
 +<jxd:propType>Object</jxd:propType>
 +<jxd:propSummary>A map of different options for</jxd:propSummary>
 +</jxd:prop>
 +</jxd:props>
 +</jxd:param>
 +</jxd:params>
 +<jxd:functionExample><code>
 +   EQ.client.init({
 +       serviceUrl: "EQService.asmx",
 +       modelName: "nwind",
 +       columnsPanel: { allowAggrColumns: true, attrElementFormat: "{attr}", showColumnCaptions: false  },
 +       queryPanel: { listRequestHandler: onListRequest }
 +   });
 +</code></jxd:functionExample>
 +<jxd:functionNotes>
 +You don't need to call this function directly if eq.view.js or eq.report.js script is used since the initilization code of those scriptions calls this function automatically.
 +</jxd:functionNotes>
 +</jxd:function>
 +
 +==== loadModel ====
 +
 +<jxd:function>
 +<jxd:functionSummary>Sends a "LoadModel" requests to the server and processes the response.</jxd:functionSummary>
 +<jxd:params>
 +<jxd:param>
 +<jxd:paramName>options</jxd:paramName>
 +<jxd:paramType>Object</jxd:paramType>
 +<jxd:paramSummary>A map of options to pass to loadModel function.</jxd:paramSummary>
 +<jxd:props>
 +<jxd:prop>
 +<jxd:propName>modelName</jxd:propName>
 +<jxd:propType>String</jxd:propType>
 +<jxd:propSummary>The name of data model to load.</jxd:propSummary>
 +</jxd:prop>
 +<jxd:prop>
 +<jxd:propName>success</jxd:propName>
 +<jxd:propType>Function</jxd:propType>
 +<jxd:propSummary>The function that is called on successfull model loading.
 +Loaded model object is passed in function's parameter.</jxd:propSummary>
 +</jxd:prop>
 +<jxd:prop>
 +<jxd:propName>beforeSend</jxd:propName>
 +<jxd:propType>Function</jxd:propType>
 +<jxd:propSummary>A function that is called before LoadModel request call.</jxd:propSummary>
 +</jxd:prop>
 +</jxd:props>
 +</jxd:param>
 +</jxd:params>
 +<jxd:functionExample><code>
 +EQ.client.loadModel({modelName: "MyModel", success: function(modelJSON) {
 +    alert("Model loaded!");
 +});
 +</code></jxd:functionExample>
 +</jxd:function>
 +
 +==== loadQuery ====
 +
 +<jxd:function>
 +<jxd:functionSummary>Sends a "LoadQuery" request to the server and processes the response.</jxd:functionSummary>
 +<jxd:params>
 +<jxd:param>
 +<jxd:paramName>options</jxd:paramName>
 +<jxd:paramType>Object</jxd:paramType>
 +<jxd:paramSummary>A map of options to pass to loadQuery function.</jxd:paramSummary>
 +<jxd:props>
 +<jxd:prop>
 +<jxd:propName>queryName</jxd:propName>
 +<jxd:propType>String</jxd:propType>
 +<jxd:propSummary>The name of query to load.</jxd:propSummary>
 +</jxd:prop>
 +<jxd:prop>
 +<jxd:propName>success</jxd:propName>
 +<jxd:propType>Function</jxd:propType>
 +<jxd:propSummary>A function that is called on successfull query load.
 +Loaded data is passed in function parameter</jxd:propSummary>
 +</jxd:prop>
 +<jxd:prop>
 +<jxd:propName>beforeSend</jxd:propName>
 +<jxd:propType>Function</jxd:propType>
 +<jxd:propSummary>A function that is called before LoadQuery request call.</jxd:propSummary>
 +</jxd:prop>
 +<jxd:prop>
 +<jxd:propName>error</jxd:propName>
 +<jxd:propType>Function</jxd:propType>
 +<jxd:propSummary>A function that is called if some error occurrs during LoadQuery AJAX call.
 +The function takes 3 parameters: response code (like 404), error message and the name of operation where the problem occurs ("LoadQuery" in this case)</jxd:propSummary>
 +</jxd:prop>
 +</jxd:props>
 +</jxd:param>
 +</jxd:params>
 +<jxd:functionExample><code>
 +EQ.client.loadQuery({queryName: "MyQuery", success: function(queryJSON) {
 +    alert("Query loaded!");
 +});
 +</code></jxd:functionExample>
 +</jxd:function>
 +
 +==== loadQueryList ====
 +
 +<jxd:function>
 +<jxd:functionSummary>Sends a "LoadQueryList" request to the server and processes the response.
 +The request contains the name of current model</jxd:functionSummary>
 +<jxd:params>
 +<jxd:param>
 +<jxd:paramName>options</jxd:paramName>
 +<jxd:paramType>Object</jxd:paramType>
 +<jxd:paramSummary>The map of options to pass to loadQuery function.</jxd:paramSummary>
 +<jxd:props>
 +<jxd:prop>
 +<jxd:propName>success</jxd:propName>
 +<jxd:propType>Function</jxd:propType>
 +<jxd:propSummary>The function that is called on successfull response.
 +Requested list of queries is passed in the function parameter</jxd:propSummary>
 +</jxd:prop>
 +<jxd:prop>
 +<jxd:propName>beforeSend</jxd:propName>
 +<jxd:propType>Function</jxd:propType>
 +<jxd:propSummary>The function that is called before LoadQueryList request call.</jxd:propSummary>
 +</jxd:prop>
 +</jxd:props>
 +</jxd:param>
 +</jxd:params>
 +<jxd:functionExample><code>
 +EQ.client.loadQueryList({success: function(listJSON) {
 +    alert("Queries: " + listJSON);
 +});
 +</code></jxd:functionExample>
 +</jxd:function>
 +
 +==== clearQuery ====
 +
 +<jxd:function>
 +<jxd:functionSummary>Clears all conditions and columns in the current query.</jxd:functionSummary>
 +</jxd:function>
 +
 +==== saveQuery ====
 +
 +<jxd:function>
 +<jxd:functionSummary>Sends "SaveQuery" request to the server and processes the response.</jxd:functionSummary>
 +<jxd:params>
 +<jxd:param>
 +<jxd:paramName>options</jxd:paramName>
 +<jxd:paramType>Object</jxd:paramType>
 +<jxd:paramSummary>The map of options to pass to SaveQuery function.</jxd:paramSummary>
 +<jxd:props>
 +<jxd:prop>
 +<jxd:propName>query</jxd:propName>
 +<jxd:propType>Object</jxd:propType>
 +<jxd:propSummary>The object that represents query to save.
 +If not set - the current query is used.</jxd:propSummary>
 +</jxd:prop>
 +<jxd:prop>
 +<jxd:propName>queryName</jxd:propName>
 +<jxd:propType>String</jxd:propType>
 +<jxd:propSummary>The name of the query</jxd:propSummary>
 +</jxd:prop>
 +<jxd:prop>
 +<jxd:propName>success</jxd:propName>
 +<jxd:propType>Function</jxd:propType>
 +<jxd:propSummary>The function that is called on successfull query saving.</jxd:propSummary>
 +</jxd:prop>
 +<jxd:prop>
 +<jxd:propName>beforeSend</jxd:propName>
 +<jxd:propType>Function</jxd:propType>
 +<jxd:propSummary>The function that is called before SaveQuery request call.
 +You can show some progress animation at this point.</jxd:propSummary>
 +</jxd:prop>
 +</jxd:props>
 +</jxd:param>
 +</jxd:params>
 +</jxd:function>
 +
 +==== buildQuery ====
 +
 +<jxd:function>
 +<jxd:functionSummary>Sends "BuildQuery" request to the server and processes the response.</jxd:functionSummary>
 +<jxd:params>
 +<jxd:param>
 +<jxd:paramName>params</jxd:paramName>
 +<jxd:paramType>Object</jxd:paramType>
 +<jxd:paramSummary>A map of parameters to pass to buildQuery function.</jxd:paramSummary>
 +<jxd:props>
 +<jxd:prop>
 +<jxd:propName>query</jxd:propName>
 +<jxd:propType>Object</jxd:propType>
 +<jxd:propSummary>An object that represents query to build.</jxd:propSummary>
 +</jxd:prop>
 +<jxd:prop>
 +<jxd:propName>extraParams</jxd:propName>
 +<jxd:propType>String</jxd:propType>
 +<jxd:propSummary>A string that represents extra parameters which are added to the request</jxd:propSummary>
 +</jxd:prop>
 +<jxd:prop>
 +<jxd:propName>success</jxd:propName>
 +<jxd:propType>Function</jxd:propType>
 +<jxd:propSummary>A function that is called on successfull query build.
 +This function takes one parameter which contains genereated statement in "statement" property
 +or the error message in "error" property if some problem occurred during query building process.</jxd:propSummary>
 +</jxd:prop>
 +<jxd:prop>
 +<jxd:propName>beforeSend</jxd:propName>
 +<jxd:propType>Function</jxd:propType>
 +<jxd:propSummary>A function that is called before BuildQuery request call.</jxd:propSummary>
 +</jxd:prop>
 +</jxd:props>
 +</jxd:param>
 +</jxd:params>
 +</jxd:function>
 +
 +==== syncQuery ====
 +
 +<jxd:function>
 +<jxd:functionSummary>Sends "SyncQuery" request to the server and processes the response.</jxd:functionSummary>
 +<jxd:params>
 +<jxd:param>
 +<jxd:paramName>params</jxd:paramName>
 +<jxd:paramType>Object</jxd:paramType>
 +<jxd:paramSummary>A map of parameters to pass to buildQuery function.</jxd:paramSummary>
 +<jxd:props>
 +<jxd:prop>
 +<jxd:propName>query</jxd:propName>
 +<jxd:propType>Object</jxd:propType>
 +<jxd:propSummary>An object that represents query to build.</jxd:propSummary>
 +</jxd:prop>
 +<jxd:prop>
 +<jxd:propName>extraParams</jxd:propName>
 +<jxd:propType>String</jxd:propType>
 +<jxd:propSummary>A string that represents extra parameters which are added to the request</jxd:propSummary>
 +</jxd:prop>
 +<jxd:prop>
 +<jxd:propName>success</jxd:propName>
 +<jxd:propType>Function</jxd:propType>
 +<jxd:propSummary>A function that is called on successfull query build.
 +This function takes one parameter which contains genereated statement in "statement" property
 +or the error message in "error" property if some problem occurred during query building process.</jxd:propSummary>
 +</jxd:prop>
 +<jxd:prop>
 +<jxd:propName>beforeSend</jxd:propName>
 +<jxd:propType>Function</jxd:propType>
 +<jxd:propSummary>A function that is called before BuildQuery request call.</jxd:propSummary>
 +</jxd:prop>
 +</jxd:props>
 +</jxd:param>
 +</jxd:params>
 +</jxd:function>
 +
 +==== buildAndExecute ====
 +
 +<jxd:function>
 +<jxd:functionSummary>Sends "ExecuteQuery" request to the server and processes the response.</jxd:functionSummary>
 +<jxd:params>
 +<jxd:param>
 +<jxd:paramName>params</jxd:paramName>
 +<jxd:paramType>Object</jxd:paramType>
 +<jxd:paramSummary>A map of parameters to pass to buildQuery function.</jxd:paramSummary>
 +<jxd:props>
 +<jxd:prop>
 +<jxd:propName>query</jxd:propName>
 +<jxd:propType>Object</jxd:propType>
 +<jxd:propSummary>An object that represents query to build and execute.</jxd:propSummary>
 +</jxd:prop>
 +<jxd:prop>
 +<jxd:propName>extraParams</jxd:propName>
 +<jxd:propType>String</jxd:propType>
 +<jxd:propSummary>A string that represents extra parameters which are added to the request</jxd:propSummary>
 +</jxd:prop>
 +<jxd:prop>
 +<jxd:propName>success</jxd:propName>
 +<jxd:propType>Function</jxd:propType>
 +<jxd:propSummary>A function that is called on successfull query build.
 +This function takes one parameter "data" - a plain object which contains genereated statement in its "statement" property
 +and the result of query execution in "resultSet" property.</jxd:propSummary>
 +</jxd:prop>
 +<jxd:prop>
 +<jxd:propName>beforeSend</jxd:propName>
 +<jxd:propType>Function</jxd:propType>
 +<jxd:propSummary>A function that is called before BuildQuery request call.</jxd:propSummary>
 +</jxd:prop>
 +</jxd:props>
 +</jxd:param>
 +</jxd:params>
 +</jxd:function>
 +
 +<PRELOAD>/apistyle.css</PRELOAD>