update zii.widgets.grid.gridview with CHtml::dropdownlist gives “Cannot read property 'ajaxType' of...












0















Got following error: "Uncaught TypeError: Cannot read property 'ajaxType' of undefined" here is my view for grid individualOrders.php



 <div class="orderBox">
<div class="heading">
<h1><img src="<?php echo Yii::app()->request->baseUrl;?/images/order.png" alt="" />Orders</h1>
</div>
<div class="content">
<?php $this->renderPartial('_statusFilter',array('model'=>$model));?>
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'order-form-grid',
'dataProvider'=>$model->filterIndividualOrders(),
//'filter'=>$model,
'summaryText' =>'',
'selectableRows'=>2,
//'rowCssClassExpression'=>'$data->color',
'columns'=>array(
'orderId',
array(
'name'=>'customerId',
'type'=>'raw',
'value'=>'CHtml::encode($data->firstName." ".$data->lastName)'
),
'orderStatus',
array(
'name'=>'TotalAmount',
'type'=>'raw',
'value'=>'Yii::app()->params["currencyINR"].CHtml::encode($data->TotalAmount)'
),
'orderPlaced',
'statusChanged',
/* array(
'name'=>'User Type',
'type'=>'raw',
'value'=>'CHtml::encode($data->userType)'
), */

array(
'header'=>'Operations',
'headerHtmlOptions'=>array('style'=>'width:80px;'),
'class'=>'CButtonColumn',
'deleteConfirmation'=>"js:'Order with ID '+$(this).parent().parent().children(':first-child').text()+' will be deleted! Continue?'",
'template'=>'{view}{update}{delete}{print}',
'buttons'=> array(
'view'=>array(
'label'=>'View',
'url'=>'Yii::app()->createUrl("sales/orderInfo",array("orderId"=>$data->orderId))',
),
'update'=>array(
'label'=>'Edit',
'url'=>'Yii::app()->createUrl("sales/orderUpdate", array("orderId"=>$data->orderId))',
),
'delete'=>array(
'label'=>'Delete',
'url'=>'Yii::app()->createUrl("sales/delete", array("orderId"=>$data->orderId))',
),
'print'=>array(
'label'=>'Print Invoice',
'imageUrl'=>Yii::app()->request->baseUrl.'/images/invoice-print.png',
'url'=>'Yii::app()->createUrl("sales/orderInvoice", array("orderId"=>$data->orderId))',
'click'=>'function(e){
e.preventDefault();
if(confirm("Do you want to print this order?"))
window.open($(this).attr("href"));
}'
),
),
),

),
)); ?>
<?phpYii::app()->clientScript->registerScript('search',"$('.selectbox').change(function() {

$.fn.yiiGridView.update('order-form-grid', {
data: $(this).serialize()
});
return false;
});
",CClientScript::POS_END);?>
</div>
</div>


view for drop down filter _statusFilter.php



<?php $form=$this->beginWidget('CActiveForm', array(
'action'=>Yii::app()->createUrl($this->route),
'method'=>'post',
'htmlOptions'=>array(
'class' => 'form-search',
),
)); ?>
<?php
$corporateList = CHtml::listData(OrderStatus::model()->findAll(),
'name', 'name');
echo CHtml::dropDownList('Order[orderStatus]', $model,
$corporateList,
array('empty' => 'Select
Status','class'=>'selectbox','id'=>'categorySelectDropDown'));
?>,
<?php $this->endWidget(); ?>


this is my controller SalesController.php



public function actionIndividualOrders()
{
$model=new Order('filterIndividualOrders');
//$model->unsetAttributes(); // clear any default values
if(isset($_GET['Order']))
$model->attributes=$_GET['Order'];
$this->render('individualOrders',array('model'=>$model));

}


and this is my modal Order.php



public function filterIndividualOrders()
{
// should not be searched.
$criteria=new CDbCriteria;
$criteria->compare('orderStatus',$this->orderStatus,true);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}


Aim is to update the grid view by selecting the status available in the dropdown list



issue : after selecting the option from dropdown list I am getting "Cannot read property 'ajaxType' of undefined" error in console.










share|improve this question





























    0















    Got following error: "Uncaught TypeError: Cannot read property 'ajaxType' of undefined" here is my view for grid individualOrders.php



     <div class="orderBox">
    <div class="heading">
    <h1><img src="<?php echo Yii::app()->request->baseUrl;?/images/order.png" alt="" />Orders</h1>
    </div>
    <div class="content">
    <?php $this->renderPartial('_statusFilter',array('model'=>$model));?>
    <?php $this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'order-form-grid',
    'dataProvider'=>$model->filterIndividualOrders(),
    //'filter'=>$model,
    'summaryText' =>'',
    'selectableRows'=>2,
    //'rowCssClassExpression'=>'$data->color',
    'columns'=>array(
    'orderId',
    array(
    'name'=>'customerId',
    'type'=>'raw',
    'value'=>'CHtml::encode($data->firstName." ".$data->lastName)'
    ),
    'orderStatus',
    array(
    'name'=>'TotalAmount',
    'type'=>'raw',
    'value'=>'Yii::app()->params["currencyINR"].CHtml::encode($data->TotalAmount)'
    ),
    'orderPlaced',
    'statusChanged',
    /* array(
    'name'=>'User Type',
    'type'=>'raw',
    'value'=>'CHtml::encode($data->userType)'
    ), */

    array(
    'header'=>'Operations',
    'headerHtmlOptions'=>array('style'=>'width:80px;'),
    'class'=>'CButtonColumn',
    'deleteConfirmation'=>"js:'Order with ID '+$(this).parent().parent().children(':first-child').text()+' will be deleted! Continue?'",
    'template'=>'{view}{update}{delete}{print}',
    'buttons'=> array(
    'view'=>array(
    'label'=>'View',
    'url'=>'Yii::app()->createUrl("sales/orderInfo",array("orderId"=>$data->orderId))',
    ),
    'update'=>array(
    'label'=>'Edit',
    'url'=>'Yii::app()->createUrl("sales/orderUpdate", array("orderId"=>$data->orderId))',
    ),
    'delete'=>array(
    'label'=>'Delete',
    'url'=>'Yii::app()->createUrl("sales/delete", array("orderId"=>$data->orderId))',
    ),
    'print'=>array(
    'label'=>'Print Invoice',
    'imageUrl'=>Yii::app()->request->baseUrl.'/images/invoice-print.png',
    'url'=>'Yii::app()->createUrl("sales/orderInvoice", array("orderId"=>$data->orderId))',
    'click'=>'function(e){
    e.preventDefault();
    if(confirm("Do you want to print this order?"))
    window.open($(this).attr("href"));
    }'
    ),
    ),
    ),

    ),
    )); ?>
    <?phpYii::app()->clientScript->registerScript('search',"$('.selectbox').change(function() {

    $.fn.yiiGridView.update('order-form-grid', {
    data: $(this).serialize()
    });
    return false;
    });
    ",CClientScript::POS_END);?>
    </div>
    </div>


    view for drop down filter _statusFilter.php



    <?php $form=$this->beginWidget('CActiveForm', array(
    'action'=>Yii::app()->createUrl($this->route),
    'method'=>'post',
    'htmlOptions'=>array(
    'class' => 'form-search',
    ),
    )); ?>
    <?php
    $corporateList = CHtml::listData(OrderStatus::model()->findAll(),
    'name', 'name');
    echo CHtml::dropDownList('Order[orderStatus]', $model,
    $corporateList,
    array('empty' => 'Select
    Status','class'=>'selectbox','id'=>'categorySelectDropDown'));
    ?>,
    <?php $this->endWidget(); ?>


    this is my controller SalesController.php



    public function actionIndividualOrders()
    {
    $model=new Order('filterIndividualOrders');
    //$model->unsetAttributes(); // clear any default values
    if(isset($_GET['Order']))
    $model->attributes=$_GET['Order'];
    $this->render('individualOrders',array('model'=>$model));

    }


    and this is my modal Order.php



    public function filterIndividualOrders()
    {
    // should not be searched.
    $criteria=new CDbCriteria;
    $criteria->compare('orderStatus',$this->orderStatus,true);
    return new CActiveDataProvider($this, array(
    'criteria'=>$criteria,
    ));
    }


    Aim is to update the grid view by selecting the status available in the dropdown list



    issue : after selecting the option from dropdown list I am getting "Cannot read property 'ajaxType' of undefined" error in console.










    share|improve this question



























      0












      0








      0








      Got following error: "Uncaught TypeError: Cannot read property 'ajaxType' of undefined" here is my view for grid individualOrders.php



       <div class="orderBox">
      <div class="heading">
      <h1><img src="<?php echo Yii::app()->request->baseUrl;?/images/order.png" alt="" />Orders</h1>
      </div>
      <div class="content">
      <?php $this->renderPartial('_statusFilter',array('model'=>$model));?>
      <?php $this->widget('zii.widgets.grid.CGridView', array(
      'id'=>'order-form-grid',
      'dataProvider'=>$model->filterIndividualOrders(),
      //'filter'=>$model,
      'summaryText' =>'',
      'selectableRows'=>2,
      //'rowCssClassExpression'=>'$data->color',
      'columns'=>array(
      'orderId',
      array(
      'name'=>'customerId',
      'type'=>'raw',
      'value'=>'CHtml::encode($data->firstName." ".$data->lastName)'
      ),
      'orderStatus',
      array(
      'name'=>'TotalAmount',
      'type'=>'raw',
      'value'=>'Yii::app()->params["currencyINR"].CHtml::encode($data->TotalAmount)'
      ),
      'orderPlaced',
      'statusChanged',
      /* array(
      'name'=>'User Type',
      'type'=>'raw',
      'value'=>'CHtml::encode($data->userType)'
      ), */

      array(
      'header'=>'Operations',
      'headerHtmlOptions'=>array('style'=>'width:80px;'),
      'class'=>'CButtonColumn',
      'deleteConfirmation'=>"js:'Order with ID '+$(this).parent().parent().children(':first-child').text()+' will be deleted! Continue?'",
      'template'=>'{view}{update}{delete}{print}',
      'buttons'=> array(
      'view'=>array(
      'label'=>'View',
      'url'=>'Yii::app()->createUrl("sales/orderInfo",array("orderId"=>$data->orderId))',
      ),
      'update'=>array(
      'label'=>'Edit',
      'url'=>'Yii::app()->createUrl("sales/orderUpdate", array("orderId"=>$data->orderId))',
      ),
      'delete'=>array(
      'label'=>'Delete',
      'url'=>'Yii::app()->createUrl("sales/delete", array("orderId"=>$data->orderId))',
      ),
      'print'=>array(
      'label'=>'Print Invoice',
      'imageUrl'=>Yii::app()->request->baseUrl.'/images/invoice-print.png',
      'url'=>'Yii::app()->createUrl("sales/orderInvoice", array("orderId"=>$data->orderId))',
      'click'=>'function(e){
      e.preventDefault();
      if(confirm("Do you want to print this order?"))
      window.open($(this).attr("href"));
      }'
      ),
      ),
      ),

      ),
      )); ?>
      <?phpYii::app()->clientScript->registerScript('search',"$('.selectbox').change(function() {

      $.fn.yiiGridView.update('order-form-grid', {
      data: $(this).serialize()
      });
      return false;
      });
      ",CClientScript::POS_END);?>
      </div>
      </div>


      view for drop down filter _statusFilter.php



      <?php $form=$this->beginWidget('CActiveForm', array(
      'action'=>Yii::app()->createUrl($this->route),
      'method'=>'post',
      'htmlOptions'=>array(
      'class' => 'form-search',
      ),
      )); ?>
      <?php
      $corporateList = CHtml::listData(OrderStatus::model()->findAll(),
      'name', 'name');
      echo CHtml::dropDownList('Order[orderStatus]', $model,
      $corporateList,
      array('empty' => 'Select
      Status','class'=>'selectbox','id'=>'categorySelectDropDown'));
      ?>,
      <?php $this->endWidget(); ?>


      this is my controller SalesController.php



      public function actionIndividualOrders()
      {
      $model=new Order('filterIndividualOrders');
      //$model->unsetAttributes(); // clear any default values
      if(isset($_GET['Order']))
      $model->attributes=$_GET['Order'];
      $this->render('individualOrders',array('model'=>$model));

      }


      and this is my modal Order.php



      public function filterIndividualOrders()
      {
      // should not be searched.
      $criteria=new CDbCriteria;
      $criteria->compare('orderStatus',$this->orderStatus,true);
      return new CActiveDataProvider($this, array(
      'criteria'=>$criteria,
      ));
      }


      Aim is to update the grid view by selecting the status available in the dropdown list



      issue : after selecting the option from dropdown list I am getting "Cannot read property 'ajaxType' of undefined" error in console.










      share|improve this question
















      Got following error: "Uncaught TypeError: Cannot read property 'ajaxType' of undefined" here is my view for grid individualOrders.php



       <div class="orderBox">
      <div class="heading">
      <h1><img src="<?php echo Yii::app()->request->baseUrl;?/images/order.png" alt="" />Orders</h1>
      </div>
      <div class="content">
      <?php $this->renderPartial('_statusFilter',array('model'=>$model));?>
      <?php $this->widget('zii.widgets.grid.CGridView', array(
      'id'=>'order-form-grid',
      'dataProvider'=>$model->filterIndividualOrders(),
      //'filter'=>$model,
      'summaryText' =>'',
      'selectableRows'=>2,
      //'rowCssClassExpression'=>'$data->color',
      'columns'=>array(
      'orderId',
      array(
      'name'=>'customerId',
      'type'=>'raw',
      'value'=>'CHtml::encode($data->firstName." ".$data->lastName)'
      ),
      'orderStatus',
      array(
      'name'=>'TotalAmount',
      'type'=>'raw',
      'value'=>'Yii::app()->params["currencyINR"].CHtml::encode($data->TotalAmount)'
      ),
      'orderPlaced',
      'statusChanged',
      /* array(
      'name'=>'User Type',
      'type'=>'raw',
      'value'=>'CHtml::encode($data->userType)'
      ), */

      array(
      'header'=>'Operations',
      'headerHtmlOptions'=>array('style'=>'width:80px;'),
      'class'=>'CButtonColumn',
      'deleteConfirmation'=>"js:'Order with ID '+$(this).parent().parent().children(':first-child').text()+' will be deleted! Continue?'",
      'template'=>'{view}{update}{delete}{print}',
      'buttons'=> array(
      'view'=>array(
      'label'=>'View',
      'url'=>'Yii::app()->createUrl("sales/orderInfo",array("orderId"=>$data->orderId))',
      ),
      'update'=>array(
      'label'=>'Edit',
      'url'=>'Yii::app()->createUrl("sales/orderUpdate", array("orderId"=>$data->orderId))',
      ),
      'delete'=>array(
      'label'=>'Delete',
      'url'=>'Yii::app()->createUrl("sales/delete", array("orderId"=>$data->orderId))',
      ),
      'print'=>array(
      'label'=>'Print Invoice',
      'imageUrl'=>Yii::app()->request->baseUrl.'/images/invoice-print.png',
      'url'=>'Yii::app()->createUrl("sales/orderInvoice", array("orderId"=>$data->orderId))',
      'click'=>'function(e){
      e.preventDefault();
      if(confirm("Do you want to print this order?"))
      window.open($(this).attr("href"));
      }'
      ),
      ),
      ),

      ),
      )); ?>
      <?phpYii::app()->clientScript->registerScript('search',"$('.selectbox').change(function() {

      $.fn.yiiGridView.update('order-form-grid', {
      data: $(this).serialize()
      });
      return false;
      });
      ",CClientScript::POS_END);?>
      </div>
      </div>


      view for drop down filter _statusFilter.php



      <?php $form=$this->beginWidget('CActiveForm', array(
      'action'=>Yii::app()->createUrl($this->route),
      'method'=>'post',
      'htmlOptions'=>array(
      'class' => 'form-search',
      ),
      )); ?>
      <?php
      $corporateList = CHtml::listData(OrderStatus::model()->findAll(),
      'name', 'name');
      echo CHtml::dropDownList('Order[orderStatus]', $model,
      $corporateList,
      array('empty' => 'Select
      Status','class'=>'selectbox','id'=>'categorySelectDropDown'));
      ?>,
      <?php $this->endWidget(); ?>


      this is my controller SalesController.php



      public function actionIndividualOrders()
      {
      $model=new Order('filterIndividualOrders');
      //$model->unsetAttributes(); // clear any default values
      if(isset($_GET['Order']))
      $model->attributes=$_GET['Order'];
      $this->render('individualOrders',array('model'=>$model));

      }


      and this is my modal Order.php



      public function filterIndividualOrders()
      {
      // should not be searched.
      $criteria=new CDbCriteria;
      $criteria->compare('orderStatus',$this->orderStatus,true);
      return new CActiveDataProvider($this, array(
      'criteria'=>$criteria,
      ));
      }


      Aim is to update the grid view by selecting the status available in the dropdown list



      issue : after selecting the option from dropdown list I am getting "Cannot read property 'ajaxType' of undefined" error in console.







      javascript php jquery yii






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 30 '18 at 9:47









      Muhammad Omer Aslam

      12.6k72544




      12.6k72544










      asked Dec 30 '18 at 9:10









      Bavithran MahendranBavithran Mahendran

      11




      11
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53976411%2fupdate-zii-widgets-grid-gridview-with-chtmldropdownlist-gives-cannot-read-pro%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53976411%2fupdate-zii-widgets-grid-gridview-with-chtmldropdownlist-gives-cannot-read-pro%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Monofisismo

          Angular Downloading a file using contenturl with Basic Authentication

          Olmecas