function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
VarunCVarunC 

Using "listviewoptions" in custom controller class

Hi,

I've created a custom controller class for contacts which I need to populate using the listviewoptions of Contact Standard Object.

I want the datatable i've used to display the contacts, using the View Filter sleected by user, and User SHOULD have the facility to create his own views.

help needed.

mtbclimbermtbclimber
The items in the listviewoptions collection are sourced from the standard list views for the respective object.  Any listview the user creates on the standard list page will be included in the list.

VarunCVarunC
Hi,

I'm using this code to set View Filters but it is not working:
Code:
List<Contact> ct = [Select AccountId, Id, Title, Phone, OwnerId, Name, MailingCity, LastName, FirstName, Email, Account.Name From Contact Order By LastName, FirstName];
ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(ct);
ssc.setFilterID('00B80000005xfRxEAI');
contacts=(List<Contact>)ssc.getRecords();


Now, the contacts LISt is still holding ALL Contact records, they are not filtered.

I've a apex pageblocktable which is displaying the contacts listing populated above.

It would help if someone was able to implement Custom View Filtering using custom controller class.


mtbclimbermtbclimber
A couple of things....

First, the collection based constructor is not going to pick up your filter specification as it has no filter to begin with.  Try the QueryLocator based constructor instead.

Second, do you have a reason to use apex?  From what I can see you can use the standard set controller directly in the page.
VarunCVarunC
Hi,

Thanks, that QueryLocatorworked fine :). And also, I needed to use Custom Views imlpementation in my controller class as I've a VF page implemented to display many options on one screen, like selected checkboxes and display and process all selected records on same page, well, i could not think of a better way then to implement all using custom controller class, using standard controller was not working for me, I could not fetch and process selected records on same page, and also, I could not implement Sorting with standard controller.

At this point of time, I now need to Default the View List Dropdown to "All Contacts", Can you also guide me here too? How can i do so? Ok and one more thing, with QueryLocator I COULD not get the Contact Records Sorted on name bases. i need them to be sorted :( ...

Thanks.
VarunCVarunC
Hi,

I'm now stuck at only SORTING & SEARCHING problem, is there any Way to execute Dynamic Query in QueryLocator ?

I need to sort and search records with FILTER in place applied to the data.

Thanks.

mtbclimbermtbclimber
QueryLocator does not support dynamic Apex.

Dynamic sorting against StandardSetController is something we are working on. For searching I presume you mean you want to dynamically add your own filter to a pre-defined one, correct?
VarunCVarunC
Yes, I want some text search enabled for selected View.

Also, one more issue, would be glad if you could shed some llight on that too :).

Since, I'm using a VF page to display a List View of records, and have Views implemented, and users can edit and create Custom Views, so I need to know a way in which I can Show Only Columns selected for a Particular View in the VF page, so if one view have 4 columns, and another view have 6 columns, so i need to know if I can show n-number of columns dynamically, and IF YES, then need some Guidance for Sure :) .. plz

Thanks.
mtbclimbermtbclimber
Also not supported today unfortunately.  I do encourage you to create ideas for these specific requests however. While we are working on some we do revisit prioritization every release.
VarunCVarunC
Thanks for the update. Also, since I'm pretty much new to the salesforce development, so is there any means to know what are the scheduled dates of Next releases, in simple words, how to keep track of Release dates, like the Next Release is Spring '09, so any specific date for it?

- Varun
mtbclimbermtbclimber
First - Welcome!

Second, we post dates on the trust page when releases are about to come out:

http://trust.salesforce.com/trust/status/

As for major releases further out we don't provide advanced notice today. It might be reasonable, however, to base your future timing expectations around our recent history. For example Spring '08 came out in early February, Summer '08 came out in early June and Winter '09 came out in early October.  While nothing is guaranteed, our development methodology should make future release timing more predictable.
VarunCVarunC
Thanks.

I just posted my request as an idea here:
http://ideas.salesforce.com/article/show/10094321/Dynamic_Column_Generation : http://ideas.salesforce.com/article/show/10094321/Dynamic_Column_Generation

- Varun
VarunCVarunC
Just one more thing, can you guide me with the conept of Catching Column names usinf APEX?

I mean, I can all Apex.StandardSetontroller() object's getListViewOptions() function, so is there any way or there is any Table where The Views created for an Opject are stored, so that I can Catch All Columns for a Particular View? I mean, there must be a table or Object which I can query Against a FilterID to get or read all column names stored in the View settings.



mtbclimbermtbclimber
There is nothing exposed to Visualforce  or Apex which allows you to do this today.
VarunCVarunC
Hi I would like to know your thoughts if this specific ListViewOptions functionality Can be implemented using ENHANCEDLIST of visualforce ?
jackpushpanjackpushpan

I have the exact requirement.. I need to  find the columns associated with a List View, is this not possible yet? Help much appreciated.

 

Thanks,

Jack

VarunCVarunC

No I don't think they have added this functionality to APEX yet.

 

StandardSetController  supports following mentioned methods only, and they do not return Columns in a view.

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_pages_standardsetcontroller.htm

jackpushpanjackpushpan

thanks for your response vchaddha. 

Almost 2 years still the feature is not implemented :(. 

Wake up force people!!