Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8503379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:44:34+00:00 2026-06-11T01:44:34+00:00

Q : how to hide the column at CGridView? status : I followed the

  • 0

Q : how to hide the column at CGridView?

status : I followed the posts from yii forum to hide the column as here and here. but in my grid view the right column didn’t hide. it is showing as a blank.

This is my view code

<?php $this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'acc-recei-grid',
    'dataProvider'=>$model->search_arlist(),
    'filter'=>$model,
    'columns'=>array(
        array('name' => 'acc_category_id',
               'value'=>'(isset($data->acccategories->name)) ? CHtml::encode($data->acccategories->name) :""',
               'filter'=>CHtml::listData($acccategory, 'id', 'name'),
        ),
        //'customer_id',
        //'date',
        array('name' => 'job_id',
               'value'=>'(isset($data->jobs->name)) ? CHtml::encode($data->jobs->name) :""',
               //'filter'=>CHtml::listData($job, 'id', 'name'),
        ),

        array(
            'class'=>'CButtonColumn',
            'template'=>'{select}',
            'buttons'=>array
            (
                'select' => array
                (
                    'imageUrl'=>Yii::app()->request->baseUrl.'/protected/assets/images/gridview/icon_select.gif',
                    'options'=>array('style'=>'width:10px; border:none'),
                    'click'=>'function(){
                        var itemID = $(this).parents(\'tr\').find(\'.recei-id\').text();
                        $("#AccPaymentRecei_acc_recei_id").val(itemID); 
                        $("#accreceilist").dialog("close");

                    }',
                ),      
            ),
        ),
        array(
            'type'=>'raw',
            'value'=>'$data->id',
            //'filter'=>array('style'=>'visible:none'), 
            'headerHtmlOptions'=>array('style'=>'width:0px; display:none; border:none; textdecoration:none'),
            'htmlOptions'=>array('style'=>'display:none; border:none;', 'class'=>'recei-id'),  
            'header'=>false,
            'filter'=>false,
        ),
    ),
)); ?>

but the grid view show like this

enter image description here

====== update

<div id="acc-recei-grid" class="grid-view">
<div class="summary">Displaying 1-1 of 1 result(s).</div>
<table class="items">
<thead>
<tr>
<th id="acc-recei-grid_c0"><a href="/mmaig_ceo/ceo-control-system/accRecei/Accreceilist?AccRecei_sort=acc_category_id">Acc Category</a></th><th id="acc-recei-grid_c1"><a href="/mmaig_ceo/ceo-control-system/accRecei/Accreceilist?AccRecei_sort=job_id">Job</a></th><th class="button-column" id="acc-recei-grid_c2">&nbsp;</th><th style="width:0px; display:none; border:none; textdecoration:none" id="acc-recei-grid_c3">&nbsp;</th></tr>
<tr class="filters">
<td><select name="AccRecei[acc_category_id]">
<option value=""></option>
<option value="1">asdfasdf</option>
</select></td><td><input name="AccRecei[job_id]" type="text" maxlength="11" /></td><td>&nbsp;</td><td>&nbsp;</td></tr>
</thead>
<tbody>
<tr class="odd"><td>asdfasdf</td><td>asdf</td><td class="button-column"><a style="width:10px; border:none" class="select" title="select" href="#"><img src="/mmaig_ceo/ceo-control-system/protected/assets/images/gridview/icon_select.gif" alt="select" /></a></td><td style="display:none; border:none;" class="recei-id">1</td></tr>
</tbody>
</table>
<div class="keys" style="display:none" title="/mmaig_ceo/ceo-control-system/AccRecei/Accreceilist"><span>1</span></div>
</div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T01:44:36+00:00Added an answer on June 11, 2026 at 1:44 am

    For your particular example you can use pure css:

    #acc-recei-grid td:last-child, #acc-recei-grid th:last-child {display: none}
    

    But there is better way to take model id in javascript than using hidden column:

    $('.yourButtonColumnCssClass').live('click', function() {
        var id = $.fn.yiiGridView.getKey(
            'acc_category_id',
            $(this).closest('tr').prevAll().length 
        );
        $("#AccPaymentRecei_acc_recei_id").val(id); 
        $("#accreceilist").dialog("close");
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know jqGrid can hide the column in grid but visiable in edit form.
How do you hide the column names and row count in the output from
Here is my code, please help me hide the id column in jqGrid, I
Possible Duplicate: how to show/ hide column in a grid panel In extjs gridpanel,
In different data types I need to hide some columns (not one) from grid.
I have a gridview, with some columns. I want to hide one column, but
How to show and hide one particular column in Mouse Over and Mouse out
I have a table column I’m trying to expand and hide. jQuery seems to
I'm looking to have a click event for all columns but the last column
How can we hide the column of the table by using jquery < table

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.