sequelize-admin-panel
Version:
Admin panel for sequelize ORM
4,008 lines (1,055 loc) • 47.3 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: ModelAdmin</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: ModelAdmin</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>ModelAdmin<span class="signature">(model)</span><span class="type-signature"></span></h2>
<div class="class-description">Wrapper over Sequelize.Model</div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="ModelAdmin"><span class="type-signature"></span>new ModelAdmin<span class="signature">(model)</span><span class="type-signature"></span></h4>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>model</code></td>
<td class="type">
<span class="param-type">Sequelize.Model</span>
</td>
<td class="description last">The model produced by Sequelize.define</td>
</tr>
</tbody>
</table>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>actions</code></td>
<td class="type">
<span class="param-type">Array.<<a href="ModelAdmin.html#~action">ModelAdmin~action</a>></span>
</td>
<td class="description last">List of actions</td>
</tr>
<tr>
<td class="name"><code>list_fields</code></td>
<td class="type">
<span class="param-type">array.<String></span>
</td>
<td class="description last">List of fields, visible on list view.
You can define nonexistent field here and define its view method via addFieldsDescriptions</td>
</tr>
<tr>
<td class="name"><code>list_links</code></td>
<td class="type">
<span class="param-type">array.<String></span>
</td>
<td class="description last">List of fields, which are links</td>
</tr>
<tr>
<td class="name"><code>list_exclude</code></td>
<td class="type">
<span class="param-type">array.<String></span>
</td>
<td class="description last">List of fields, excluded from list view
You can define nonexistent field here to show all fields</td>
</tr>
<tr>
<td class="name"><code>list_per_page</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">Number of entries on list view page</td>
</tr>
<tr>
<td class="name"><code>search_fields</code></td>
<td class="type">
<span class="param-type">array.<String></span>
</td>
<td class="description last">Searchable fields
if not set -- all STRING and TEXT fields</td>
</tr>
<tr>
<td class="name"><code>ordering</code></td>
<td class="type">
<span class="param-type">array.<String></span>
</td>
<td class="description last">Default model list ordering, prepend minus means desc order
example: ['date', '-active']</td>
</tr>
<tr>
<td class="name"><code>editor_fields</code></td>
<td class="type">
<span class="param-type">array.<String></span>
</td>
<td class="description last">List of fields, visible on entry editor screen</td>
</tr>
<tr>
<td class="name"><code>readonly_fields</code></td>
<td class="type">
<span class="param-type">array.<String></span>
</td>
<td class="description last">List of readonly fields</td>
</tr>
<tr>
<td class="name"><code>icon</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Html code of icon in model list screen. Default <span class="oi oi-list"></span></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ModelAdmin_index.js.html">ModelAdmin/index.js</a>, <a href="ModelAdmin_index.js.html#line32">line 32</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="model"><span class="type-signature">(readonly) </span>model<span class="type-signature"> :Sequelize.Model</span></h4>
<div class="description">
Model instance
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Sequelize.Model</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ModelAdmin_index.js.html">ModelAdmin/index.js</a>, <a href="ModelAdmin_index.js.html#line265">line 265</a>
</li></ul></dd>
</dl>
<h4 class="name" id="name"><span class="type-signature">(readonly) </span>name<span class="type-signature"> :String</span></h4>
<div class="description">
Model name
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">String</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ModelAdmin_index.js.html">ModelAdmin/index.js</a>, <a href="ModelAdmin_index.js.html#line274">line 274</a>
</li></ul></dd>
</dl>
<h4 class="name" id="namePlural"><span class="type-signature">(readonly) </span>namePlural<span class="type-signature"> :String</span></h4>
<div class="description">
Model plural name
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">String</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ModelAdmin_index.js.html">ModelAdmin/index.js</a>, <a href="ModelAdmin_index.js.html#line283">line 283</a>
</li></ul></dd>
</dl>
<h4 class="name" id="pkName"><span class="type-signature">(readonly) </span>pkName<span class="type-signature"> :String</span></h4>
<div class="description">
Model primary key name
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">String</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ModelAdmin_index.js.html">ModelAdmin/index.js</a>, <a href="ModelAdmin_index.js.html#line292">line 292</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id=".entryRenderer"><span class="type-signature">(static) </span>entryRenderer<span class="signature">(req, res, next)</span><span class="type-signature"></span></h4>
<div class="description">
Render entry editor view instead default one
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>req</code></td>
<td class="type">
<span class="param-type">Express.Request</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>res</code></td>
<td class="type">
<span class="param-type">Express.Response</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>next</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ModelAdmin_index.js.html">ModelAdmin/index.js</a>, <a href="ModelAdmin_index.js.html#line326">line 326</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".modelListRenderer"><span class="type-signature">(static) </span>modelListRenderer<span class="signature">(req, res, next)</span><span class="type-signature"></span></h4>
<div class="description">
Render model view instead default model list
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>req</code></td>
<td class="type">
<span class="param-type">Express.Request</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>res</code></td>
<td class="type">
<span class="param-type">Express.Response</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>next</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ModelAdmin_index.js.html">ModelAdmin/index.js</a>, <a href="ModelAdmin_index.js.html#line317">line 317</a>
</li></ul></dd>
</dl>
<h4 class="name" id="addExtraResource"><span class="type-signature"></span>addExtraResource<span class="signature">(resources)</span><span class="type-signature"></span></h4>
<div class="description">
Push extra js or css to page <head> section.
Resources can be tag <script|link...> or url
or array of those. Url type is determined by endsWith('js|css')
so you can add #js to end.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>resources</code></td>
<td class="type">
<span class="param-type">String</span>
|
<span class="param-type">Array.<String></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ModelAdmin_index.js.html">ModelAdmin/index.js</a>, <a href="ModelAdmin_index.js.html#line210">line 210</a>
</li></ul></dd>
</dl>
<h4 class="name" id="addFieldDescriptions"><span class="type-signature"></span>addFieldDescriptions<span class="signature">(descriptions)</span><span class="type-signature"></span></h4>
<div class="description">
Add field descriptions
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>descriptions</code></td>
<td class="type">
<span class="param-type"><a href="ModelAdmin.html#~fieldDescriptions">ModelAdmin~fieldDescriptions</a></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ModelAdmin_index.js.html">ModelAdmin/index.js</a>, <a href="ModelAdmin_index.js.html#line199">line 199</a>
</li></ul></dd>
</dl>
<h4 class="name" id="beforeListRender"><span class="type-signature"></span>beforeListRender<span class="signature">(req, count, entries)</span><span class="type-signature"></span></h4>
<div class="description">
Override this to do something before model list will rendered,
for example do subquery or compute average. You have to cache the result
within req object to use it in <a href="ModelAdmin.html#~viewRenderer">ModelAdmin~viewRenderer</a> callback
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>req</code></td>
<td class="type">
<span class="param-type">Express.Request</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>count</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">Count of selected entries considering search param</td>
</tr>
<tr>
<td class="name"><code>entries</code></td>
<td class="type">
<span class="param-type">Array.<Object></span>
</td>
<td class="description last">Selected entries</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ModelAdmin_index.js.html">ModelAdmin/index.js</a>, <a href="ModelAdmin_index.js.html#line315">line 315</a>
</li></ul></dd>
</dl>
<h4 class="name" id="overrideTypeSetter"><span class="type-signature"></span>overrideTypeSetter<span class="signature">(type, setter)</span><span class="type-signature"></span></h4>
<div class="description">
Override setter function for selected field type
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">type for override, e.g. DATE, HasOne etc</td>
</tr>
<tr>
<td class="name"><code>setter</code></td>
<td class="type">
<span class="param-type"><a href="ModelAdmin.html#~setter">ModelAdmin~setter</a></span>
</td>
<td class="description last">render function</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ModelAdmin_index.js.html">ModelAdmin/index.js</a>, <a href="ModelAdmin_index.js.html#line256">line 256</a>
</li></ul></dd>
</dl>
<h4 class="name" id="overrideTypeView"><span class="type-signature"></span>overrideTypeView<span class="signature">(type, renderer)</span><span class="type-signature"></span></h4>
<div class="description">
Override view render function for selected field type
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">type for override, e.g. DATE, HasOne etc</td>
</tr>
<tr>
<td class="name"><code>renderer</code></td>
<td class="type">
<span class="param-type"><a href="ModelAdmin.html#~viewRenderer">ModelAdmin~viewRenderer</a></span>
</td>
<td class="description last">render function</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ModelAdmin_index.js.html">ModelAdmin/index.js</a>, <a href="ModelAdmin_index.js.html#line246">line 246</a>
</li></ul></dd>
</dl>
<h4 class="name" id="overrideTypeWidget"><span class="type-signature"></span>overrideTypeWidget<span class="signature">(type, widgetRenderer)</span><span class="type-signature"></span></h4>
<div class="description">
Override widget render function for selected type
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">type for override, e.g. enum of Sequelise.TYPE - DATE, HasOne etc</td>
</tr>
<tr>
<td class="name"><code>widgetRenderer</code></td>
<td class="type">
<span class="param-type"><a href="ModelAdmin.html#~widgetRenderer">ModelAdmin~widgetRenderer</a></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ModelAdmin_index.js.html">ModelAdmin/index.js</a>, <a href="ModelAdmin_index.js.html#line236">line 236</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
widget html
</div>
<h4 class="name" id="repr"><span class="type-signature"></span>repr<span class="signature">(req, entry)</span><span class="type-signature"> → {String|Promise.<String>}</span></h4>
<div class="description">
Override this for custom entry representation,
default is entry label + primary key
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>req</code></td>
<td class="type">
<span class="param-type">Express.Request</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>entry</code></td>
<td class="type">
<span class="param-type">Sequelize.ModelInstance</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ModelAdmin_index.js.html">ModelAdmin/index.js</a>, <a href="ModelAdmin_index.js.html#line303">line 303</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
|
<span class="param-type">Promise.<String></span>
</dd>
</dl>
<h4 class="name" id="setFieldDescription"><span class="type-signature"></span>setFieldDescription<span class="signature">(fieldName, description)</span><span class="type-signature"></span></h4>
<div class="description">
Set description for field fieldName
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>fieldName</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>description</code></td>
<td class="type">
<span class="param-type"><a href="ModelAdmin.html#~fieldDescription">ModelAdmin~fieldDescription</a></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ModelAdmin_index.js.html">ModelAdmin/index.js</a>, <a href="ModelAdmin_index.js.html#line191">line 191</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id="~action">action</h4>
<div class="description">
Represent action structure. Define name and *ONE* of [renderer|changer] callback.
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">action name</td>
</tr>
<tr>
<td class="name"><code>renderer</code></td>
<td class="type">
<span class="param-type"><a href="ModelAdmin.html#~actionRenderer">ModelAdmin~actionRenderer</a></span>
</td>
<td class="description last">render function</td>
</tr>
<tr>
<td class="name"><code>changer</code></td>
<td class="type">
<span class="param-type"><a href="ModelAdmin.html#~actionChanger">ModelAdmin~actionChanger</a></span>
</td>
<td class="description last">simple entry change function</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ModelAdmin_index.js.html">ModelAdmin/index.js</a>, <a href="ModelAdmin_index.js.html#line654">line 654</a>
</li></ul></dd>
</dl>
<h4 class="name" id="~actionChanger"><span class="type-signature"></span>actionChanger<span class="signature">(entry)</span><span class="type-signature"> → {Promise|any}</span></h4>
<div class="description">
Simple per-entry update callback, just get entry and update it fields
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>entry</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ModelAdmin_index.js.html">ModelAdmin/index.js</a>, <a href="ModelAdmin_index.js.html#line678">line 678</a>
</li></ul></dd>
<dt class="tag-todo">To Do:</dt>
<dd class="tag-todo">
<ul>
<li>show errors</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
|
<span class="param-type">any</span>
</dd>
</dl>
<h4 class="name" id="~actionRenderer"><span class="type-signature"></span>actionRenderer<span class="signature">(req, res, modelAdmin, ids, exit)</span><span class="type-signature"> → {Promise.<String>}</span></h4>
<div class="description">
Full-featured render callback. You can create own navigation, confirmation, etc.
Also, you must handle transaction manually.
To return to entry list call exit callback
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>req</code></td>
<td class="type">
<span class="param-type">Express.Request</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>res</code></td>
<td class="type">
<span class="param-type">Express.Response</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>modelAdmin</code></td>
<td class="type">
<span class="param-type"><a href="ModelAdmin.html">ModelAdmin</a></span>
</td>
<td class="description last">ModelAdmin instance, associated with current model</td>
</tr>
<tr>
<td class="name"><code>ids</code></td>
<td class="type">
<span class="param-type">Array.<*></span>
</td>
<td class="description last">list of selected model primaryKeys</td>
</tr>
<tr>
<td class="name"><code>exit</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">return callback, redirects to entry list</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ModelAdmin_index.js.html">ModelAdmin/index.js</a>, <a href="ModelAdmin_index.js.html#line663">line 663</a>
</li></ul></dd>
<dt class="tag-todo">To Do:</dt>
<dd class="tag-todo">
<ul>
<li>show errors</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
page html
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.<String></span>
</dd>
</dl>
<h4 class="name" id="~fieldDescription">fieldDescription</h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>view</code></td>
<td class="type">
<span class="param-type"><a href="ModelAdmin.html#~viewRenderer">ModelAdmin~viewRenderer</a></span>
|
<span class="param-type">String</span>
</td>
<td class="description last">View renderer or type name</td>
</tr>
<tr>
<td class="name"><code>html</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last">Indicates that view produce html, so you must escape it self</td>
</tr>
<tr>
<td class="name"><code>widget</code></td>
<td class="type">
<span class="param-type"><a href="ModelAdmin.html#~widgetRenderer">ModelAdmin~widgetRenderer</a></span>
|
<span class="param-type">String</span>
</td>
<td class="description last">Widget renderer or type name</td>
</tr>
<tr>
<td class="name"><code>setter</code></td>
<td class="type">
<span class="param-type"><a href="ModelAdmin.html#~setter">ModelAdmin~setter</a></span>
|
<span class="param-type">String</span>
</td>
<td class="description last">setter function or type name</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ModelAdmin_index.js.html">ModelAdmin/index.js</a>, <a href="ModelAdmin_index.js.html#line692">line 692</a>
</li></ul></dd>
</dl>
<h4 class="name" id="~fieldDescriptions">fieldDescriptions</h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>$fieldName</code></td>
<td class="type">
<span class="param-type"><a href="ModelAdmin.html#~fieldDescription">ModelAdmin~fieldDescription</a></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ModelAdmin_index.js.html">ModelAdmin/index.js</a>, <a href="ModelAdmin_index.js.html#line686">line 686</a>
</li></ul></dd>
</dl>
<h4 class="name" id="~setter"><span class="type-signature"></span>setter<span class="signature">(req, entry, fieldName, transaction)</span><span class="type-signature"> → {Promise}</span></h4>
<div class="description">
Set value of entry field $fieldName given at req.body[fieldName]
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>req</code></td>
<td class="type">
<span class="param-type">Express.Request</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>entry</code></td>
<td class="type">
<span class="param-type">Sequelize.ModelInstance</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>fieldName</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>transaction</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ModelAdmin_index.js.html">ModelAdmin/index.js</a>, <a href="ModelAdmin_index.js.html#line723">line 723</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h4 class="name" id="~viewRenderer"><span class="type-signature"></span>viewRenderer<span class="signature">(req, entry, fieldName)</span><span class="type-signature"> → {String|Promise.<String>}</span></h4>
<div class="description">
Render entry field for table view
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>req</code></td>
<td class="type">
<span class="param-type">Express.Request</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>entry</code></td>
<td class="type">
<span class="param-type">Sequelize.ModelInstance</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>fieldName</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ModelAdmin_index.js.html">ModelAdmin/index.js</a>, <a href="ModelAdmin_index.js.html#line701">line 701</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
|
<span class="param-type">Promise.<String></span>
</dd>
</dl>
<h4 class="name" id="~widgetRenderer"><span class="type-signature"></span>widgetRenderer<span class="signature">(req, entry, fieldName, value, options)</span><span class="type-signature"> → {String|Promise.<String>}</span></h4>
<div class="description">
Render entry field for editor widget
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>req</code></td>
<td class="type">
<span class="param-type">Express.Request</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>entry</code></td>
<td class="type">
<span class="param-type">Sequelize.ModelInstance</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>fieldName</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last">Raw field value from database entry or http post request</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">widget options, readOnly mostly</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="ModelAdmin_index.js.html">ModelAdmin/index.js</a>, <a href="ModelAdmin_index.js.html#line711">line 711</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
rendered html widget
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
|
<span class="param-type">Promise.<String></span>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-cli.html">cli</a></li><li><a href="module-sequelize-admin-panel.html">sequelize-admin-panel</a></li></ul><h3>Classes</h3><ul><li><a href="ModelAdmin.html">ModelAdmin</a></li><li><a href="ModelAdminManager.html">ModelAdminManager</a></li></ul><h3>Namespaces</h3><ul><li><a href="req.html">req</a></li><li><a href="req.SA.html">SA</a></li><li><a href="req.SA.utils.html">utils</a></li><li><a href="res.html">res</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed May 30 2018 09:23:34 GMT+0700 (+07)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>