Yii Framework Forum: Cgridview Customize Update By Textfield - Yii Framework Forum

Jump to content

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

Cgridview Customize Update By Textfield I have CGridview for showing list.. Rate Topic: -----

#1 User is offline   Cymon Xrisomngam 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 13-February 13

Posted 28 March 2013 - 03:26 AM

I have CGridview for showing list of product look like this

+-------------------------------------------------+
|item id | item name | Order Qty | Unit |
+-------------------------------------------------+
| 0001 | Product 001 | [.......] | KG. |
| 0002 | Product 002 | [.......] | Pg. |
| 0003 | Product 003 | [.......] | Pg. |
| 0004 | Product 004 | [.......] | Btl. |
| 0005 | Product 005 | [.......] | KG. |
+-------------------------------------------------+

I need to input Order Qty when press enter<no need save button please>, data sending to server to save it by ajax and execute INSERT or UPDATE SQL.

Anyone have solutions?
my code is

<?php  
  $this->widget('zii.widgets.grid.CGridView', array(
    'id' => 'secOrderGrid',   
      'ajaxUpdate'=>false,
    'dataProvider' => $dataProvider->search($merge),   
        'filter'=>$dataProvider,  
    'enablePagination' => true,   
       'columns' => array(  
                             array(
                   'name' => 'item_no',
                   'header' => 'Item Id',
                   'htmlOptions'=>array('style'=>'text-align: left; width:50px;'),
               ),
               array(
                   'name' => 'item.item_name',
                   'header' => 'Item Name',
                   'htmlOptions'=>array('style'=>'text-align: left; width:350px;'),
               ),
               array(
                   'header' => 'Quantity',
                   'type'=>'raw',
                   'value'=>'CHtml::textField("$data[item_no]","0",array("style"=>"width:40px;text-align:right;"))',
                   'htmlOptions'=>array('style'=>'text-align: center; width:10%;'),
               ),
               array(
                   'name' => 'item.unit_code',
                   'header' => 'Unit',
                   'htmlOptions'=>array('style'=>'text-align: left; width:50px;'),
               ),  
            ),
   )); 
 ?>

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