Yii 1.1: yii-inlineedit

Provides simple opportunity for replacing model field values with editable textareas
2 followers

Provides simple opportunity for replacing model field values with editable textareas. New values sends via AJAX. Several customization available.

Requirements

Yii 1.1 or above and jQuery.

Installation

To use this extension:

1) copy InlineEdit.php to your components directory

2) check that your config have autoloaded

    'import'=>array(
        ...
        'application.components.*',
        ...

Usage

Assuming that you have $model - Article activerecord class object with field title and primaryKey = 1 and you need it to be inline editable in your view:

echo InlineEdit::textField($model, 'title', $model->title);

You can disable such behavior, just echoing $value (for example if you need to show textares only for admins)

echo InlineEdit::textField($model, 'title', $model->title, $enable);

in such case inline editable textareas will be shown only if $enable == true.

If you need just string value, without sending it to output set $return to true:

$output = InlineEdit::textField($model, 'title', $model->title, true, true);

Default ajax url setted to Article/update/1 but you always can change it:

echo InlineEdit::textField($model, 'title', $model->title, true, false, '/<your new url for ajax save call>/');

Resources

Be the first person to leave a comment

Please to leave your comment.

Create extension