Yii Framework Forum: Editable gridview - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Editable gridview Rate Topic: -----

#1 User is offline   Pedi 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 15-October 14

Posted 25 November 2014 - 12:00 AM

I'm trying to change the element value using Jquery but it's not working...

This is my widget where I have my element 'tag' which i want to change it to textField on edit...

$this->widget('EditableGrid', array(
    'dataProvider' => $dataProvider->searchbyID($invoice_id),
    'template' => '{items}{buttonCreateRow}{pager} ',
    'id' => 'InvoiceLine-grid',
    'rowTemplate' => $row_template,
    'columns' => array(   
            array(
            'class' => 'EditableGridColumn',
            'header' => '',
            'name' => 'InvoiceLine_{gridNum}_{rowNum}_edit',
            'imageurl'=> Yii::app()->request->baseUrl.'/images/update.png',
            'tag' => 'button',
            'tagHtmlOptions' => array(
            'onclick'=>'editline(this)',
                )
            ),
            array(
            'class' => 'EditableGridColumn',
            'header' => 'StentysRef',
            'name' => '[{gridNum}][{rowNum}]stentysproductref',
            'tag' => 'laabel',          
            'tagHtmlOptions' => array(
                'style'=>'background-color:#FFF;border-color:#FFF',
            'onkeyup'=>'stentysref(this)',
                'readonly'=>true
                )
            ), 


My Jquery is,

(as you can see the removeAttr works but attr doesn't)
function editline(obj){
	var status = <?php echo $status;?>;	
	if(status ==  "1")	
	{
	var id = obj.id;	
	var trun = 	id.substring(14);	
	var row= trun.substr(0, trun.indexOf('_')); 

	$("#InvoiceLine_1_"+row+"_stentysproductref").attr("tag","textField");
	$("#InvoiceLine_1_"+row+"_stentysproductref").removeAttr("readonly");
	$("#InvoiceLine_1_"+row+"_qtyexpected").removeAttr("readonly");
	$("#InvoiceLine_1_"+row+"_price").removeAttr("readonly");
	}
}

0

#2 User is offline   moginn 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 284
  • Joined: 07-April 12
  • Location:Spain

Posted 24 December 2014 - 06:41 AM

you wrote 'tag' => 'laabel' instead of 'tag' => 'label',
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users