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 8034699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:06:10+00:00 2026-06-05T02:06:10+00:00

been looking for a solution to add a feature for Custom Columns… Meaning, I

  • 0

been looking for a solution to add a feature for “Custom Columns”… Meaning, I present a list of columns that I can show the user and he selects the ones he wants to see and after the selection the table is updated and add/removes the needed columns.

Didn’t find anything on Google (perhaps it has a different name than what I was looking for…)

Anyone has an Idea on how it can be accomplished?

Thanks in advance!

  • 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-05T02:06:11+00:00Added an answer on June 5, 2026 at 2:06 am

    This is not a complete sample, but can give you some clues on how to implement it. You’ve to define some kind of form to collect the data about how your grid has to be rendered. I recommend you to create a CFormModel class if there are more than 3 input fields. Create a view file with the form and a div or renderPartial of a file containing a grid:

    $form = $this->beginWidget('CActiveFormExt');
    echo $form->errorSummary($model);
    echo $form->labelEx($model,'column1');
    echo $form->dropDownList($model
    echo $form->error($model,'column1');
    echo CHtml::ajaxSubmitButton('UpdateGrid',array('controller/grid'),
                                    array('update'=>'#grid'),
    $this->endWidget();
    // you can render the 'default options' before any ajax update
    $this->renderPartial('_grid',array($customColumns=>array('id','name'),'dataProvider'=>$dataProvider));
    

    In the _grid.php view file:

    $this->widget('zii.widgets.grid.CGridView', array(
        'id' => 'grid',
        'dataProvider'=>$dataProvider,
        'columns' => $customColumns;
    ));
    

    In the controller:

    function actionGrid(){
        // recover the form data, and build the custom columns array
        $customColumns = array();
        $customColumns[] = '.....';
    
        $dataProvider = ...;
    
        $this->renderPartial('_formTrabajo', array('customColumns' => $idSiniestro, 'dataProvider' => $dataProvider'), false);
    }
    

    When you click the ajaxSubmitButton, the form is sent to the url specified through ajax, and the reply from the controller must contain the renderPartial of the view containing the grid, so the jQuery call can replace the html correctly. You must pass an array from your controller to the partial view of the grid, with the custom list of columns you want to display.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been looking for a solution and found similar questions, only they were attempting
I have been looking for a solution but I don't think this is possible
I've been looking for a solution to disable the form submit button until the
I've been looking around for a solution to this thing but I haven't found
I've been looking for hours the solution. I've 3 models atm. Priority: using System;
I have been looking long for a solution how to pass the value from
I've been looking all over the internet for a solution to the following error;
Okay, I've been looking all over the web to find a solution but I
I've been looking for solutions that provide a couple of types of protection and
I have been looking around a lot but i simply can't find a nice

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.