Skip to content

Commit 830e5e2

Browse files
committed
widget Index bug fixed
1 parent 5059ab2 commit 830e5e2

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Ajax/common/Widget.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public function insertInField($index,$field){
197197
/**
198198
* Defines the function which displays the field value
199199
* @param $index index or name of the field to display
200-
* @param callable $callback function parameters are : $value : the field value ,$index : the field index, $instance : the active instance of model
200+
* @param callable $callback function parameters are : $value : the field value, $instance : the active instance of model, $fieldIndex : the field index, $rowIndex : the row index
201201
* @return Widget
202202
*/
203203
public function setValueFunction($index,$callback){

Ajax/semantic/widgets/base/FieldAsTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected function _applyAttributes(BaseHtml $element,&$attributes,$index){
4545
if(isset($attributes["jsCallback"])){
4646
$callback=$attributes["jsCallback"];
4747
if(\is_callable($callback)){
48-
$callback($element,$this->_modelInstance,$index);
48+
$callback($element,$this->_modelInstance,$index,InstanceViewer::$index);
4949
//unset($attributes["jsCallback"]);
5050
}
5151
}
@@ -81,7 +81,7 @@ protected function _prepareFormFields(HtmlFormField &$field,$name,&$attributes){
8181
}
8282

8383
protected function _fieldAs($elementCallback,&$index,$attributes=NULL,$prefix=null){
84-
$this->setValueFunction($index,function($value,$instance,$index) use (&$attributes,$elementCallback,$prefix){
84+
$this->setValueFunction($index,function($value,$instance,$index,$rowIndex) use (&$attributes,$elementCallback,$prefix){
8585
$caption=$this->_getFieldCaption($index);
8686
$name=$this->_getFieldName($index);
8787
$id=$this->_getFieldIdentifier($prefix,$name);

Ajax/semantic/widgets/base/InstanceViewer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,13 @@ protected function _getValue($property,$index){
117117

118118
protected function _postGetValue($index,$propertyName,$value){
119119
if(isset($this->values[$index])){
120-
$value= $this->values[$index]($value,$this->instance,$index);
120+
$value= $this->values[$index]($value,$this->instance,$index,self::$index);
121121
}else{
122-
$value=$this->_getDefaultValue($propertyName,$value, $index);
122+
$value=$this->_getDefaultValue($propertyName,$value, self::$index);
123123
}
124124
if(isset($this->afterCompile[$index])){
125125
if(\is_callable($this->afterCompile[$index])){
126-
$this->afterCompile[$index]($value,$this->instance,$index);
126+
$this->afterCompile[$index]($value,$this->instance,self::$index);
127127
}
128128
}
129129
return $value;

0 commit comments

Comments
 (0)