WYSWIG-like JSON format editor, witch uses jQuery, JSON Editor plugin
Now package also have class CJuiJSONEditorInput, it can be used as an raw input field, or an input field for an ActiveRecord forms
Resources ¶
Documentation ¶
Requirements ¶
- Yii 1.0 or above
Installation ¶
- Extract the release file under
protected/extensions
Usage ¶
See the following code example:
// raw editor only
$this->widget('ext.jsonEditorView.JSONEditorView', array(
'data'=>'{"value":"Initial JSON data-string"}',
));
// Input field, raw format
$this->widget('ext.jsonEditorView.JuiJSONEditorInput', array(
'name'=>'field_name',
'data'=>'{}' // Initial JSON data string
));
// Input field, ActiveRecord format
$this->widget('ext.jsonEditorView.JuiJSONEditorInput', array(
'model'=>$model // ActiveRecord, or any CModel child class
'attribute'=>'attribute_name' // Model attribute holding initial JSON data string
));
Change Log ¶
2011.01.06 ¶
- fixed bug that widget produced broken JS on empty data field
September 19, 2010 ¶
- fixed bug with wrong jQuery selector
September 17, 2010 ¶
- Added ability to send modified JSON contents in POST form
- Added JuiJSONEditorInput widget
September 16, 2010 ¶
- Initial release.
Awesome component
Wonder why nobody has rated this wonderful component already.
Works like a charm and is very powrful.
One minor bugfix:
JuiJSONEditorInput, line 72
if($this->hasModel() && !$this->model->isNewRecord)
Otherwise it fails when creating a new record.
Very neat
Very helpful to manage mongo data
Problem with sending data
When i use it in form input field sends no data, in avctie record mode. reading data works fine, but there is no params as if there was no field.
Problem with sending data
It do not work when field is empty.
Problem with sending data
When I added {} to empty field it works fine. I fink i should add {} when field is empty.
Forgot closing tag
At the end of run() function in JSONEditorView, before
echo CHtml::endForm();
add
echo CHtml::closeTag('div');
In JuiJSONEditorInput at the end of run() function before closing bracket, add
echo CHtml::closeTag('div');
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.