yii-inlineedit Provides simple opportunity for replacing model field values with editable textareas

  1. Requirements
  2. Installation
  3. Usage
  4. Resources

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

1 0
1 follower
225 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: User Interface
Developed by: hastenax
Created on: May 25, 2014
Last updated: 10 years ago

Downloads

show all

Related Extensions