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
protected/extensionsSee 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 ));
Total 6 comments
At the end of run() function in JSONEditorView, before
add
In JuiJSONEditorInput at the end of run() function before closing bracket, add
When I added {} to empty field it works fine. I fink i should add {} when field is empty.
It do not work when field is empty.
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.
Very helpful to manage mongo data
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.
Leave a comment
Please login to leave your comment.