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
Josh Gruberman 12Josh Gruberman 12 

List Multiple Records on the Same Visualforce Page

I am having trouble wrapping my head around this so if someone could help me with a start to the code, I would be very grateful.  

I have a custom object called Inventory__c.  It has Year__c, Make__c, and Model__c custom fields and I want to display the Year, Make and Model for each record within the Inventory object in a grid layout similar to this: https://webtemplatemasters.com/screenshots/cardealer/wordpress-car-theme-search.jpg.

I'm going to theme it accordingly and do all the styles, but I can't seem to figure out how to get the records in that sort of grid layout.  I know I need a custom controller, but not sure how to write it or invoke it from the VF page. 

Any help would be great. thanks a lot

Saurabh BSaurabh B
Hi Josh,
I have worked on a similar project and I used Bootstrap to achieve this. Bootstrap is an open source CSS and Jscript library which you can use within Salesforce. Here is what I would recommend,

Step 1 -
Install this package and look at some examples featured on the site,
http://blogforce9dev-developer-edition.ap1.force.com/ProjectDetail?id=a0290000009MI61

Step 2 -
After you install this, you should be able to use grid layout (See example 10 A. and 10 B. on below link) in Visualforce page.
http://visualstrap-developer-edition.ap1.force.com/apex/VisualStrapComponents

Some other ways to create Grids -
Lightning - https://trailhead.salesforce.com/modules/lightning_design_system/units/lightning-design-system3
VF - https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_panelGrid.htm

Hope this helps.

Please mark this as Best Answer if it helps!

 
Josh Gruberman 12Josh Gruberman 12
Hi Saurabh,
Would Bootstrap automatically build the necessary controllers that I would need for the VF page or is that something seperate and Bootstrap will just help me with the grid layout?
Saurabh BSaurabh B

Josh,
Bootstrap will just help you with Grid Layout or any other layout that you want to present. If you doing this project in Standard or Custom Object, just use "StandardController". That will give you all the standard sObject attributes that you need. If you need need more customized logic, you can always build a custom controller. Hope this helps.

Thanks!

Josh Gruberman 12Josh Gruberman 12
@Saurabh, my question was to help with the custom controller.  I can create the grid layout myself with HTML tables at the very basic level, however I am lacking the ability to create the controller