Hello all,
if someone is using the nice plugin ejeditable accessible at
http://www.yiiframework.com/extension/ejeditable
and have experienced the same problem of not having multiple plugin working in the same YII view (for example for text and select)
you could try to apply the following patch
file: EJEditable.php
/**
* Run this widget.
* This method registers necessary javascript and renders the needed HTML code.
*/
public function run()
{
$jsoptions = CJavaScript::encode($this->options, true);
// recursively merge `data_attr` into `options` with $.extend(true,...)
$extend_submitdata_code = "";
if($this->submitDataAttributes == true) {
$extend_submitdata_code = "
var data_attr = {'submitdata':{}};
$.each($(this).data(), function(i,e) {
data_attr['submitdata'][i] = e;
});
$.extend(true, options, data_attr);
";
}
$add_attribute_code = "";
if(!empty($this->attribute)) {
$add_attribute_code = "
if(!('attribute' in options['submitdata'])) {
options['submitdata']['attribute'] = '{$this->attribute}';
}
";
}
$rr = rand(0,1000); // add this line
$jscode = "function init_editable$rr(jquerySelector) { // add $rr var here
$(jquerySelector).each( function(item) {
var url = '{$this->url}';
var options = {$jsoptions};
{$extend_submitdata_code}
{$add_attribute_code}
$(this).editable(url, options);
});
}";
Yii::app()->getClientScript()->registerScript(__CLASS__ . "_{$this->jquerySelector}", $jscode, CClientScript::POS_HEAD);
// Register js-code that initializes editables when page has loaded and is ready
Yii::app()->clientScript->registerScript(
"init_editables$rr", // add $rr var here
"init_editable$rr('{$this->jquerySelector}'); ",// add $rr var here
CClientScript::POS_READY
);
}
hope it helps,
Alessandro