How to create a double list view

There are three options for you to start.

Create the view from scratch

The only thing that your view needs to do to be a legal Site Manager view is to inherit from the base Site Manager view:

public partial class DoubleListView : LSOne.ViewCore.ViewBase

You will then have to overwrite key methods from the base class to get your functionality ready. To get an idea of which functions to overload, see the functions overview below.

Copy DoubleListView from the Hello World plugin

You can copy almost any view from the Site Manager and customize it based on your needs. To make this process simpler we have created view templates with minimal functionality included. You can find a template view for a double list view in the Hello World plugin from the Site Manager part of the development package. The view is called DoubleListView and you can copy it into your plugin. The view contains a shell for the basic functionality of a double list view.

Functions overview

Base functions

This is a list of functions that are most commonly overwritten to add logic to your view:

Base functions

Description

void LoadData(
bool isRevert)

Here we load data into our top list view. This involves fetching the list of data objects and populating the list view with it.  The isRevert variable is false unless the user pressed the Revert button above the Context bar. That function is supposed to revert to the last saved state of the view (basically reverting all changes that have not yet been saved).

RecordIdentifier ID

Returns the ID of the view and is used to determine if the view is already visible and does not need to be reloaded. Usually you return the ID of the object you are working with, but since you have a double list view you return RecordIdentifier.Empty

string LogicalContextName

Returns the string that should appear directly above the Context bar.

void GetAuditDescriptors(

List<AuditDescriptor> contexts)

Connects the view with an audit view. See chapter Auditing for more details.

void OnDataChanged(..)

This is the opposite function of NotifyDataChanged(..) function that we covered in chapter How to create a simple view . This is the listener function and when another view or dialog wants to notify all open views about changes then this function is called. This function is mainly used to reload the list of objects to make sure we are showing the latest version of the data.

List view operations

This is a list of common functions that are connected to the list views. Please note that these functions might not have the exact same names of the functions in your view because they usually contain the name of the list view (here we use the name topListView and btmListView for the two list views).

List view functions

Description

void topListView_SelectionChanged

AND

void btmListView_SelectionChanged

These functions are called when the user changes the selected index of either list view. Here you need to check if the user clicked on a data object row or if they clicked outside the data rows. If they did not click on a data object row you need to disable the edit and delete buttons below the list view. Additionally, in the top list view function you need to hide the bottom list view as well.

void topListView_RowDoubleClick

AND

void btmListView_RowDoubleClick

These functions are called when the user double clicks on either list view. For the top list view you need to make sure that the user clicked on a data object row. If they did you should open the edit view or dialog.

The same is true for the bottom list view, but note that when we do not allow the rows in the bottom list view to be edited then we do not have this function.

void topListView_HeaderClick

AND

void btmListView_HeaderClick  

These functions are called when the user clicks on a column of either list view. This is usually used to order the results of the list views depending on the clicked column. Note that to keep the examples simple these functions are not used in the Hello World DoubleListView.

void topListView_Opening

AND

void btmListView_Opening

These functions are called when the user right-clicks on either list view. These functions are usually linked to the list views in the constructor. In this function you can add different operations that appear to the user in a drop-down list.

Buttons operations

This is a list of the six functions behind the context buttons that are usually located below the two list views. Note that it is customary in the Site Manager to disable buttons that you cannot press. This means that the user should not be able to open an add dialog if they do not have permission to add the object.

Context buttons functions

Description

void btnsTop_AddButtonClicked

AND

void btnsBtm_AddButtonClicked

These operations are called when the user presses the green plus buttons below the list views.

For the top list view this usually triggers a dialog showing either all the fields that can be edited or just the mandatory fields. If only mandatory fields are shown then the user is redirected to a view for the data object where they can edit the optional parameters of the object.

For the bottom list view it usually only shows a dialog and never a view.

void btnsTop_EditButtonClicked

AND

void btnsBtm_EditButtonClicked

These operations are called when the user presses the yellow pencil buttons below the list views. For the top list view this should either trigger a dialog where the data object can be edited (if it has a limited amount of information) or another view where the data object can be edited.

For the bottom list view we usually use a dialog to edit and it is usually the same dialog as when adding. Note that when we don’t allow the editing of rows from the bottom list view then the edit button below the list view is not shown (see the Context property of the buttons) and then this function is not used.

void btnsTop_RemoveButtonClicked

AND

void btnsBtm_RemoveButtonClicked

These operations are called when the user presses the red minus buttons below the list views. This usually triggers the question, does the user really wants to delete the selected object (this is not a requirement)? If the user presses Yes then the data object is deleted through the data layer.

Sample code walkthrough

 

Next up is the first exercise in Lesson 5: Lesson 5 - Plugins: views, tabs and dialogs