How_to_Add_Custom_Sections_to_View_Tab[Permalink]How to Add Custom Sections to the View tabThe View tab is intended to give the user a detailed view of the contents of a record. By default it shows the values of each non-empty field grouped into their appropriate field groups. It also shows the most recent 5 related records from each relationship in the record. You can also add your own sections by implementing the section__xxx? method of the delegate class. Example 1: A "Hello World" SectionWe'll start by adding a simple section that simply displays "Hello World" to the user. In the delegate class for your table, add the following method:
Now if you reload our application and click on the "View" tab for any of the records in the database, you'll notice a section labelled hello with the text Hello World!!! in it. Let's dissect the above code so that we can better understand what is going on here.
Customizing the Section Labelhello is a boring label, so let's add our own custom label by adding the label key to the array returned by our method:
Now if you load the view tab of your application, you'll notice that the section has a heading "Message of the Day". Customizing the Section OrderA section can also specify an order attribute to define the order in which this section should appear. It defaults to 0 which may cause the section to appear at the top of the view tab. You can push it to the bottom of the view tab by assiging a higher number to the order attribute:
Now if you reload the view tab you'll notice that the section has moved to the bottom of the page. blog comments powered by Disqus |