jonson.xu 2012-07-23 10:50:00 2446次浏览 0条回复 0 0 0

cgridview调用另一model时。过滤无效。 另外如何使用 'click'=>'function(){alert("1");alert("e");};其中1为该条数据的id.e为该条数据的mat_name

<script language="javascript">
    function setMatname(id,matname)
    {
        alert(id);
        $("#mat_id").val(id);
        $("#mat_name").val(matname);
    }
</script>
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'matinwarehouse-form',
	'enableAjaxValidation'=>false,
)); ?>
<?php echo $form->errorSummary($model); ?>
    <div class="row">
    <?php echo $form->label($model,'indate'); ?>
    <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array( 
    'attribute' => 'indate', 
    'model'=>$model, 
    'name'=>'date', 
    'options' => array( 
            'showAnim' => 'fold', 
            'dateFormat' => 'yy-mm-dd', 
        ), 
    )); ?>
	</div>
    <div class="row">
		<?php echo $form->labelEx($model,'mat_name'); ?>
		<?php echo $form->textField($model,'mat_name',array('id'=>'mat_name')); ?>
		<?php echo $form->error($model,'mat_name'); ?>
	</div>
  
	<div class="row">
		<?php echo $form->labelEx($model,'mat_in_warehouse_stock'); ?>
		<?php echo $form->textField($model,'mat_in_warehouse_stock'); ?>
		<?php echo $form->error($model,'mat_in_warehouse_stock'); ?>
	</div>
        	<div class="row">
		<?php echo $form->labelEx($model,'matid'); ?>
		<?php echo $form->textField($model,'matid',array('id'=>'mat_id',)); ?>
		<?php echo $form->error($model,'mat_in_warehouse_stock'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? '新建' : '保存'); ?>
	</div>
  <div class="row">
  <?php
  $matbase=new matbase();
//$matbaseData=$matbase->search()->getData();
  $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'matbase-grid',
	'dataProvider'=>$matbase->search(),
	'filter'=>$matbase,
        'emptyText'=>'没数据',
        'ajaxUpdate'=> 'true',
        'selectableRows'=>'true',
	'columns'=>array(
		'id',
		'mat_name',
		'stock',
		'min_out_warehouse',
		'unit',
		array(
			'class'=>'CButtonColumn',
                'header'=>'操作',
                'template'=>'{addPost}',
                'deleteButtonOptions'=>array('style'=>'display:none'),
                'updateButtonOptions'=>array('style'=>'display:none'),
                'viewButtonOptions'=>array('style'=>'display:none'),
                'buttons'=>array(
                    'addPost'=>array(
                        'label'=> '选中',
                        'click'=>'function(){alert("1");alert("e");};'
                    ),
                ),
             ),
         ),
)); ?>
      </div>
<?php $this->endWidget(); ?>

</div><!-- form -->

    没有找到数据。
您需要登录后才可以回复。登录 | 立即注册