You need to sign in to do that
Don't have an account?

Adding Columns Dynamically to Datatable on Button click
Hai friends,
I am trying to add columns to data table dynamically,but i am not getting my requirement please help me for this scenario,
Scenario:- We need to display all required fields in datatable on page load,after that we need o take input from page,as how many number of columns should add,here if u entered 5 ,then 5 columns should add on button click to datatable,then after if u enetered 5 then from remaining list of fields 5 fields should added to datatable as columns.
Please help me
Thanks in Advance
sfdc Elephant
Hi,
For your help I created this example of dyanmic columns , I tried to cover yoru req in this
please recreate this in your org once and try to figure out the code how I achived it.
Controller :
VFP
I will be explaning it in more detail on my blog later in the day whenver I will get time. Will update you then. Please ask if you want to understand in above example.
All Answers
Hi,
For your help I created this example of dyanmic columns , I tried to cover yoru req in this
please recreate this in your org once and try to figure out the code how I achived it.
Controller :
VFP
I will be explaning it in more detail on my blog later in the day whenver I will get time. Will update you then. Please ask if you want to understand in above example.
Hai Sharma,
Thank u so much Sharma.......Its Awesome.........But it should be more dynamic.........I think.... Any way ....Great Effort...
Thank u
SfBluefish
Hi, I would request you to mark it as a solution if you find it as answer to your question dynamic no of columns in a pageblock table. You can ask any further question if there is any other issue in your req, the best would be you mark this and start a new thread by creating a new post for further queries.