OneDealer XML Grid List Page is an extension of OneDealer XML Page that displays data in a grid list view. The definition of the page is similar to XML Pages as described in OneDealer XML Pages with extra definition regarding grid list configuration and data source.

The page type is declare in Page element in the attribute type as a OD Fully qualified assembly name

OneDealer XML Grid List Page Type

One.Core.UI.MVC.Pages.XmlPages.XmlGridListBasePage, One.Core.UI.MVC

Data Source

In the Common section of the XML page we need to declare the PageDataProvider element, which is the way that OneDealer understands what is needed to be executed in order to retrieve data and display them.

IncadeaGridListPageBinderProvider

OD Fully Qualified Assembly Name

OneDealer.IncadeaDemo.BusinessLayer.Models.IncadeaGridListPageBinderProvider, OneDealer.IncadeaDemo.BusinessLayer

This page data provider is specifically designed and implemented for the needs of Incadea and it is consisted from an IncadeaDataProvider

PropertyDescriptionValue Type
Urlthe url to retrieve the datastring
RequestTypethe request type GET/POSTstring
CacheAn object related to cache configurationelement
PostParametersIf the request is a POST request declare here the required parameterselement

Cache

PropertyDescriptionValue Type
DurationThe duration of the result object which is kept in the cacheint

PostParameters

PropertyDescriptionValue Type
KeyThe name of the parameter to sentstring
ValueThe value of the parameter to sentstring

Javascript Bundles

As we have mentioned in OneDealer XML Pages, in the Javascript Bundles the developer can add an extra javascript file that contains any additional behavior to the page.

In the example below you will see that the following js files has been added `IncadeaPageDataManager.js` and has a logic related to Page Actions in order to facilitate development.

It adds a function named `PageActionToIncadeaDataProvider`, which when this used in the Page Action, in the `OnBeforeAjaxCallback` element it does the following:

  • Adds to ManagerPageCallback with an default interface and method name
  • Gets the declared Url element of the Page Action
  • Sets the RequestType to POST
  • Adds the PostParameters based on the declared action parameters

and then it proceeds to the execution of the request.

Alternatively, the developer should fill in the above required field in order execute the request.

OneDealer XML Grid List Page - Example of Common Section
<?xml version="1.0" encoding="utf-8"?>
<Page type="One.Core.UI.MVC.Pages.XmlPages.XmlGridListBasePage, One.Core.UI.MVC">
  <Common>
    <Title>Test Page</Title>
	<!-- GridList's data source is a Page Data Provider -->
    <PageDataProvider type="OneDealer.IncadeaDemo.BusinessLayer.Models.IncadeaGridListPageBinderProvider, OneDealer.IncadeaDemo.BusinessLayer">
      <IncadeaDataProvider>
        <Url>/incadeaapi/get_aftersales_data/{request[vehicleCode]}</Url>
        <RequestType>GET</RequestType>
      </IncadeaDataProvider>
    </PageDataProvider>
	<!-- Javascript Bundles -->
	<!-- This javascript file adds additional features to the page, for example it makes easier to create Page Actions for Incadea -->
    <JavascriptBundles>
      <Item>~/Installations/IncadeaDemo/Scripts/IncadeaPageDataManager.js</Item>
    </JavascriptBundles>
  </Common>
</Page>

IncadeaDataProvider

You can read more about IncadeaDataProvider in the OneDealer XML Pages - Incadea Reference

Xml Grid List Page

The Xml Grid List Page is a xml definition with the name XmlGridListPage and it contains an array of columns

Column

A column in the xml grid list is consisted from the following basic elements

NameDescriptionRequiredValue Type
TypeThe Type of the column Text, Link, Image, Check, Dropdown, etc
  •  
string - OD fully qualified assembly name
ColumnNameThe name that will be displayed in the header of the column
  •  
string
ColumnTitleCssThe css of the title
string
ResourceKeyThe resource key for translation
string
PropertyNameThe name of the property model to bind / display
  •  
string
SortPropertyNameThe name of the property model to sort
string
SpecificCheckedValue


DefaultDisplayIf the column is visible (default false)
  •  
bool
ExtraHtmlAttribute

string
AllowReorderingif the column is allowed to perform ordering
bool
HideColumnNameOnMobileHide column on mobile devices
bool
AllowExportExcelAllow column to be exported to the excel
bool
AdditionalCssClassAdditional css class
string
ColumnItemClassCss class for the item
string
OrderColumn display order
int
SortingDirectionSorting Direction
string (ASC / DESC)
HelpTextA text for help info
string
HelpTextResourcethe resource key for the help text
string

Column Types

There are several available Column Types and each one inherits from the base column type as referenced above. The Column Types are the following:

TypeDescriptionOD Fully Qualified Assembly Name
GridListTextColumnDisplays textOne.Core.UI.MVC.Pages.GridList.GridListTextColumn, One.Core.UI.MVC
GridListPhoneColumnSimilar to text , but formatted for phone numbersOne.Core.UI.MVC.Pages.GridList.GridListPhoneColumn, One.Core.UI.MVC
GridListMailColumnSimilar to text, but with a link to the emailOne.Core.UI.MVC.Pages.GridList.GridListMailColumn, One.Core.UI.MVC
GridListLookupStaticColumnA dropdown / Look up control with static referenced dataOne.Core.UI.MVC.Pages.GridList.GridListLookupStaticColumn, One.Core.UI.MVC
GridListLinkColumnSimilar to text, but with a link to the contentOne.Core.UI.MVC.Pages.GridList.GridListLinkColumn, One.Core.UI.MVC
GridListImageColumnDisplays imagesOne.Core.UI.MVC.Pages.GridList.GridListImageColumn, One.Core.UI.MVC
GridListIconColumnDisplays fa iconsOne.Core.UI.MVC.Pages.GridList.GridListIconColumn, One.Core.UI.MVC
GridListDateTimeColumnFormatted Date time columnOne.Core.UI.MVC.Pages.GridList.GridListDateTimeColumn, One.Core.UI.MVC
GridListCheckboxColumnCheckbox columnOne.Core.UI.MVC.Pages.GridList.GridListCheckboxColumn, One.Core.UI.MVC
GridListPageActionsColumnGrid List Page ActionsOne.Core.UI.MVC.Pages.GridList.GridListPageActionsColumn, One.Core.UI.MVC

Extra Options of each column type

GridListTextColumn : GridListBaseColumn
NameDescriptionValue Type
IsHtmlRawif the content of the text is HTML (Default: False)bool
FormatThis is used for numeric data (Example N2, #,00)string
IsTimeFormatted as "dd/MM/yyyy HH:mm"bool
IgnoreZeroif value is 0 then converts it to emptybool
UrlEncodeIf it is encoded it does an Http Decodebool
MaxLengthDisplays the text to the declared max lengthint
IsReadMoreDisplays a "read more" elementbool
GridListLookupStaticColumn : GridListBaseColumn
NameDescriptionValue Type
DropDownListItemsA XML array of static valuesXML Array Element
DropDownListItems
NameDescriptionValue Type
TextThe Text to displaystring
ValueThe actual Valuestring
Enabledif it is enabledbool
SelectedIf it is selectedbool
GridListLinkColumn : GridListTextColumn
NameDescriptionRequiredValue Type
ALL THE FIELDS FROM

GridListTextColumn




ParamNameThe name of the param that will be sent
string
Urlthe url
  •  
string
PropertyKeyThe name of the property to be displayed
string
ParamNameSecondthe name of the 2nd parameter that will be sent
string
PropertyKeySecondthe name of the 2nd property key
string
OpenInNewTabif it will open in a new tab
bool
ValueToBeReplacedstate here the value that needs to be replaced
string
ValueToReplaceWithState here the new value that will replace the old one
string
IconClassToShowfa icon to be displayed
string
GridListImageColumn : GridListBaseColumn
NameDescriptionRequiredValue Type
DefaultImageDefault image url if fails to load the declared
string
UrlUrl of image to load
string
PropertyKeyThe property field from the model to be sent as value parameter
string
ParamNamethe name of the parameter to be sent
string
ImagePrefixAn image prefix name
string
ImageWidthImage width
int
MobileImageWidthMobile Image width
int
HeightImage Height
int
MobileHeightMobile Image Height
int
GridListIconColumn : GridListBaseColumn
NameDescriptionValue Type
IconClassThe fa icon classstring
GridListDateTimeColumn : GridListBaseColumn
NameDescriptionRequiredValue Type
DatePropertyNameThe property field name to display the date
  •  
string
TimePropertyNameThe property field name to display the date
string
FormatFormat field (Default: "dd/MM/yyyy HH:mm")
string
ShowOnlyDateif true shows only date
bool
ShowEmptyIfTimeIsNullif time is null show empty string
bool

Example

OneDealer XML Grid List Page
<?xml version="1.0" encoding="utf-8"?>
<Page type="One.Core.UI.MVC.Pages.XmlPages.XmlGridListBasePage, One.Core.UI.MVC">
  <Common>
    <Title>Test Grid List Page</Title>
    <PageDataProvider type="OneDealer.IncadeaDemo.BusinessLayer.Models.IncadeaGridListPageBinderProvider, OneDealer.IncadeaDemo.BusinessLayer">
      <IncadeaDataProvider>
        <!--<Url>/incadeaapi/get_aftersales_data/{request[vehicleCode]}</Url>-->
        <Url>/ListDataPaged</Url>
        <RequestType>GET</RequestType>
      </IncadeaDataProvider>
    </PageDataProvider>
    <JavascriptBundles>
      <Item>~/Installations/IncadeaDemo/Scripts/IncadeaPageDataManager.js</Item>
    </JavascriptBundles>
  </Common>
  <OneDealerPage>
    <CssClassIcon>fa-text</CssClassIcon>
    <PageActions>
      <XmlPageAction>
        <PageAction>
          <Title>Create New</Title>
          <CssClass>fa-plus</CssClass>
          <IsPopupPageAction>true</IsPopupPageAction>
          <Url>/externalcontroller/AjaxPopup</Url>
        </PageAction>
        <Parameters>
          <XmlPageActionParameter>
            <DataKey>pageId</DataKey>
            <DataValue>TestIncadeaFormPopup</DataValue>
          </XmlPageActionParameter>
        </Parameters>
      </XmlPageAction>
    </PageActions>
  </OneDealerPage>
  <XmlGridListPage>
    <Columns>
      <Column type="One.Core.UI.MVC.Pages.GridList.GridListLinkColumn, One.Core.UI.MVC">
        <Order>1</Order>
        <ColumnName>String</ColumnName>
        <PropertyName>TestString</PropertyName>
        <DefaultDisplay>true</DefaultDisplay>
        <Url>/externalcontroller?pageId=TestIncadeaTabPage</Url>
        <ParamName>TestInt</ParamName>
        <PropertyKey>TestInt</PropertyKey>
      </Column>
      <Column type="One.Core.UI.MVC.Pages.GridList.GridListTextColumn, One.Core.UI.MVC">
        <Order>2</Order>
        <ColumnName>Bool</ColumnName>
        <PropertyName>TestBool</PropertyName>
        <DefaultDisplay>true</DefaultDisplay>
      </Column>
      <Column type="One.Core.UI.MVC.Pages.GridList.GridListCheckboxColumn, One.Core.UI.MVC">
        <Order>3</Order>
        <ColumnName>Check</ColumnName>
        <PropertyName>TestBool</PropertyName>
        <DefaultDisplay>true</DefaultDisplay>
        <Disabled>true</Disabled>
        <Checked>TestBool</Checked>
        <SpecificCheckedValue>True</SpecificCheckedValue>
      </Column>
      <Column type="One.Core.UI.MVC.Pages.GridList.GridListTextColumn, One.Core.UI.MVC">
        <Order>4</Order>
        <ColumnName>Char</ColumnName>
        <PropertyName>TestChar</PropertyName>
        <DefaultDisplay>true</DefaultDisplay>
      </Column>
      <Column type="One.Core.UI.MVC.Pages.GridList.GridListTextColumn, One.Core.UI.MVC">
        <Order>5</Order>
        <ColumnName>Int</ColumnName>
        <PropertyName>TestInt</PropertyName>
        <DefaultDisplay>true</DefaultDisplay>
      </Column>
      <Column type="One.Core.UI.MVC.Pages.GridList.GridListTextColumn, One.Core.UI.MVC">
        <Order>6</Order>
        <ColumnName>Long</ColumnName>
        <PropertyName>TestLong</PropertyName>
        <DefaultDisplay>true</DefaultDisplay>
      </Column>
      <Column type="One.Core.UI.MVC.Pages.GridList.GridListTextColumn, One.Core.UI.MVC">
        <Order>7</Order>
        <ColumnName>Float</ColumnName>
        <PropertyName>TestFloat</PropertyName>
        <DefaultDisplay>true</DefaultDisplay>
      </Column>
      <Column type="One.Core.UI.MVC.Pages.GridList.GridListTextColumn, One.Core.UI.MVC">
        <Order>8</Order>
        <ColumnName>Double</ColumnName>
        <PropertyName>TestDouble</PropertyName>
        <DefaultDisplay>true</DefaultDisplay>
      </Column>
      <Column type="One.Core.UI.MVC.Pages.GridList.GridListTextColumn, One.Core.UI.MVC">
        <Order>9</Order>
        <ColumnName>DateTime</ColumnName>
        <PropertyName>TestDateTime</PropertyName>
        <DefaultDisplay>true</DefaultDisplay>
        <Format>yyyy-MM-dd HH:mm</Format>
      </Column>
      <Column type="One.Core.UI.MVC.Pages.GridList.GridListTextColumn, One.Core.UI.MVC">
        <Order>10</Order>
        <ColumnName>TimeSpan (Minutes)</ColumnName>
        <PropertyName>TestTimeSpan.TotalMinutes</PropertyName>
        <DefaultDisplay>true</DefaultDisplay>
      </Column>
      <Column type="One.Core.UI.MVC.Pages.GridList.GridListPageActionsColumn, One.Core.UI.MVC">
        <DefaultDisplay>true</DefaultDisplay>
        <Actions>
          <XmlPageAction>
            <PageAction>
              <Title>Edit</Title>
              <CssClass>fa-edit</CssClass>
              <IsFullPageAjax>true</IsFullPageAjax>
              <Url>/externalcontroller</Url>
            </PageAction>
            <Parameters>
              <XmlPageActionParameter>
                <DataKey>pageId</DataKey>
                <DataValue>TestIncadeaTabPage</DataValue>
              </XmlPageActionParameter>
              <XmlPageActionParameter>
                <DataKey>TestInt</DataKey>
                <MapperDataProvider>
                  <FromProperty>TestInt</FromProperty>
                  <ToProperty>DataValue</ToProperty>
                </MapperDataProvider>
              </XmlPageActionParameter>
            </Parameters>
          </XmlPageAction>
          <XmlPageAction>
            <PageAction>
              <Title>Edit Popup</Title>
              <CssClass>fa-edit</CssClass>
              <Url>/externalcontroller/AjaxPopup</Url>
              <IsPopupPageAction>true</IsPopupPageAction>
            </PageAction>
            <Parameters>
              <XmlPageActionParameter>
                <DataKey>pageId</DataKey>
                <DataValue>TestIncadeaFormPopup</DataValue>
              </XmlPageActionParameter>
              <XmlPageActionParameter>
                <DataKey>TestInt</DataKey>
                <MapperDataProvider>
                  <FromProperty>TestInt</FromProperty>
                  <ToProperty>DataValue</ToProperty>
                </MapperDataProvider>
              </XmlPageActionParameter>
            </Parameters>
          </XmlPageAction>
        </Actions>
      </Column>
    </Columns>
  </XmlGridListPage>
</Page>


Result


  • No labels
Write a comment…