Properties

$type

$type : string

Type

string — type of editable widget. Can be `text`, `textarea`, `select`, `date`, `checklist`, etc.

$url

$url : string

Type

string — url to submit value. Can be string or array containing Yii route, e.g. `array('site/updateUser')`

$pk

$pk : mixed

Type

mixed — primary key

$name

$name : string

Type

string — name of field

$params

$params : array

Type

array — additional params to send on server

$inputclass

$inputclass : string

Type

string — css class of input. If `null` - default X-editable value is used: `input-medium`

$mode

$mode : string

Type

string — mode of input: `inline` | `popup`. If not set - default X-editable value is used: `popup`.

$text

$text : string

Type

string — text to be shown as element content

$value

$value : mixed

Type

mixed — initial value. If not set - will be taken from text

$placement

$placement : string

Type

string — placement of popup. Can be `left`, `top`, `right`, `bottom`. If `null` - default X-editable value is used: `top`

$emptytext

$emptytext : string

Type

string — text shown on empty field. If `null` - default X-editable value is used: `Empty`

$showbuttons

$showbuttons : string

Type

string — visibility of buttons. Can be boolean `false|true` or string `bottom`.

$send

$send : string

Type

string — Strategy for sending data on server. Can be `auto|always|never`. When 'auto' data will be sent on server only if **pk** and **url** defined, otherwise new value will be stored locally.

$disabled

$disabled : boolean

Type

boolean — will editable be initially disabled. It means editable plugin will be applied to element, but you should call `.editable('enable')` method to activate it. To totally disable applying 'editable' to element use **apply** option.

$source

$source : mixed

Type

mixed — source data for **select**, **checklist**. Can be string (url) or array in format: array( array("value" => 1, "text" => "abc"), ...)

$format

$format : string

Type

string — format to send date on server. If `null` - default X-editable value is used: `yyyy-mm-dd`.

$viewformat

$viewformat : string

Type

string — format to display date in element. If `null` - equals to **format** option.

$template

$template : string

Type

string — template for **combodate** input. For details see http://vitalets.github.com/x-editable/docs.html#combodate.

$combodate

$combodate : array

Type

array — full config for **combodate** input. For details see http://vitalets.github.com/combodate/#docs

$viewseparator

$viewseparator : string

Type

string — separator used to display tags.

$select2

$select2 : array

Type

array — full config for **select2** input. For details see http://ivaynberg.github.com/select2

$validate

$validate : string

A javascript function that will be invoked to validate value.

Example:

'validate' => 'js: function(value) {
    if($.trim(value) == "") return "This field is required";
}'

Type

string

$success

$success : string

A javascript function that will be invoked to process successful server response.

Example:

'success' => 'js: function(response, newValue) {
    if(!response.success) return response.msg;
}'

Type

string

$display

$display : string

A javascript function that will be invoked to custom display value.

Example:

'display' => 'js: function(value, sourceData) {
     var escapedValue = $("<div>").text(value).html();
     $(this).html("<b>"+escapedValue+"</b>");
}'

Type

string

$liveTarget

$liveTarget : string

DOM id of target where afterAjaxUpdate handler will call live update of editable element

Type

string

$liveSelector

$liveSelector : string

jQuery selector of elements to wich will be applied editable.

Usefull in combination of liveTarget when you want to keep field(s) editble after ajaxUpdate

Type

string

$onInit

$onInit : string

A javascript function that will be invoked when editable element is initialized

Type

string

$onShown

$onShown : string

A javascript function that will be invoked when editable form is shown Example: <pre> 'onShown' => 'js: function() { var $tip = $(this).data("editableContainer").tip(); $tip.find("input").val("overwriting value of input."); }' </pre>

Type

string

$onSave

$onSave : string

A javascript function that will be invoked when new value is saved Example: <pre> 'onSave' => 'js: function(e, params) { alert("Saved value: " + params.newValue); }' </pre>

Type

string

$onHidden

$onHidden : string

A javascript function that will be invoked when editable form is hidden Example: <pre> 'onHidden' => 'js: function(e, reason) { if(reason === "save" || reason === "cancel") { //auto-open next editable $(this).closest("tr").next().find(".editable").editable("show"); } }' </pre>

Type

string

$options

$options : array

Type

array — all config options of x-editable. See full list <a href="http://vitalets.github.com/x-editable/docs.html#editable">here</a>.

$htmlOptions

$htmlOptions : array

Type

array — HTML options of element. In `TbEditableColumn` htmlOptions are PHP expressions so you can use `$data` to bind values to particular cell, e.g. `'data-categoryID' => '$data->categoryID'`.

$encode

$encode : boolean

Type

boolean — whether to HTML encode text on output

$apply

$apply : boolean

Type

boolean — whether to apply 'editable' js plugin to element. Only **safe** attributes become editable.

$title

$title : string

Type

string — title of popup. If `null` - will be generated automatically from attribute label. Can have token {label} inside that will be replaced with actual attribute label.

$themeUrl

$themeUrl : string

Type

string — for jQuery UI only. The root URL that contains JUI theme folders. If not set, default Yii's theme will be used.

$theme

$theme : string

Type

string — for jQuery UI only. The JUI theme name.

$cssFile

$cssFile : mixed

Type

mixed — for jQuery UI only. The theme CSS file name. By default Yii's jquery UI css used.

$_prepareToAutotext

$_prepareToAutotext

Methods

init()

init()

initialization of widget

buildHtmlOptions()

buildHtmlOptions()

buildJsOptions()

buildJsOptions()

registerClientScript()

registerClientScript()

registerAssets()

registerAssets()

run()

run()

renderLink()

renderLink()

renderText()

renderText()

getSelector()

getSelector()

isAutotext()

isAutotext(mixed $options, mixed $type)

Returns is autotext should be applied to widget: e.g. for 'select' to display text for id

Parameters

mixed $options
mixed $type

source()

source(mixed $models, mixed $valueField, mixed $textField, mixed $groupField, mixed $groupTextField)

Returns php-array as valid x-editable source in format: [{value: 1, text: 'text1'}, {.

..}]

See https://github.com/vitalets/x-editable-yii/issues/37

Parameters

mixed $models
mixed $valueField
mixed $textField
mixed $groupField
mixed $groupTextField

attachAjaxUpdateEvent()

attachAjaxUpdateEvent(mixed $widget)

injects ajaxUpdate event into widget

Parameters

mixed $widget

registerJQueryUI()

registerJQueryUI()

method to register jQuery UI with build-in or custom theme