List Page

Shows list of entities in tile,card or grid style

Basic Usage

HTML Structure

<require from="{user_path}/list_pages/list_page"></require>
<cst-list-page get-data-callback.bind="{getDataCallback}" options.bind="{options}" evt-sub-item-click-callback="{evtSubItemClickCallback}" title.bind="{title}" ext-data.bind="{extData}"></cst-list-page>

Bindable Properties

Property NameData TypeRequiredDecription
getDataCallbackmethodYesCallback method to get the data
optionsobjectNoBasic component options
evtSubItemClickCallbackmethodNoMethod to be called when any clickabel item is clicked
titleobjectNoTo be shown on the top of page
extDatastringNoChanged data by an outer event

Structure of bindable properties

getDataCallback
getDataCallback(overrideContext, _idArr, _sortingDataObj): returns a data object
data: {
IdArr: []
DetailsArr: []
Options: {} }

sortingDataObj = { property: '', direction: '' }

*If options are coming with data in call back than those options will be considered over the bindable proprty.*

evtSubItemClickCallback
evtSubItemClickCallback(overrideContext, _dataObj, _valueProp, _iconClicked)

options
{
showMoreAfterCount : 5,
tableViewSerialNumHeading: '',
uniqueIdProp: 'Id',
countToLoadNextData: 20,
viewType: {
  type: '',
  variant: ''
},
additionalAttr : {
  attrName: attrValProp
},
displayItems: [
   label: '',
   labelProp: '',
   valueProp: '',
   value: '',
   dataType: '',
   dataTypeFormat: '',
   dataTypeOptions: '',
   separator: '',
   tooltip: '',
   maxChar: '',
   isEvtSubItemClick: '',
   sortByValues: []

] }

*options Properties Description*

Property NameData TypeRequiredDecriptionPossible ValuesDefault Values
showMoreAfterCountnumberNoCount after which data will be considered as more dataAny Number5
tableViewSerialNumHeadingstringNoHeading to show Serial Num Column in Table ViewAny stringundefined
uniqueIdPropstringNoPrimary key Property of dataAny property nameId
countToLoadNextDatanumberNoHow many records should be loaded for next PageAny Number20
viewTypeobjectNoWhich View and which variant of view to be shownType: 'Tile/Table', Variant:
For Type = 'Tile', it can be 'Tile/Card'
For Type = 'Table', it can be 'Table/PaginationTable'
Type: 'Tile', Variant: 'Tile'
displayItemsarrayNoInformation about showing data.ArrayCreated from data
sortByValuesarrayNoValues to be shown for sorting.ArrayEmpty array

*Display Items Properties Description*

Property NameData TypeRequiredDecriptionPossible ValuesDefault Values
labelstringNoLabel to show in front of ValueAny string''
labelPropstringNoProperty to be mapped in data to get LabelAny property''
valuePropstringYes if DisplayItems givenProperty to be mapped in data to get ValueAny property''
valuestringNoValue to be shownAny type of data''
dataTypestringNoType of dataString/Date/Number/Icons/HTMLString
dataTypeFormatstringNoFormat in which Data needs to be formattedDD/MM/YYYY,DD-MM-YYYY....If type is Date then, 'DD/MM/YYYY'
else ''
dataTypeOptionsobjectNoOptions related to data typeAny options{}
separatorstringNoseparator to be used b/w data and value , ':'... 
tooltipstringNoTitle to be shown on hoverAny string''
maxCharnumberNoMaximum characters of data to be shownAny number200
isEvtSubItemClickbooleanNoIs data clickable or nottrue/falsefalse

title
title = {
message: ''
}

title
sortByValues = [{
label: ''
valueProp: ''
sortDesc: ''
}]

CSS Overriding

Following Classes are given to override CSS:

  • .page-override : Component Container
  • .tile-card-view-override: Tile/Card View container
  • .item-override: Items/Tiles/Cards
  • .item-override[data-id=${UniqueIdProp}]: Particular Tile/Card
  • .subitem-override: SubItems
  • .subitem-override[data-value=${valueProp}]: Particular SubItem
  • .label-override: Lables
  • .separator-override: Separators
  • .value-override: Values
  • .table-view-override: Table View Container
  • .row-override: Rows
  • .row-override[data-id=${UniqueIdProp}]: Particular Row
  • .column-override: Columns
  • .column-override[data-value=${valueProp}]: Particular Column

Functionality

Component's

  • Pass a view type in options to show that particular view.
  • If View is not passed, we can change the views by clicking on View Type icons.
  • title can be passed to show a Message on top of Component.

All View's Common

  • An 'ActionItemClass' and a '${valueProp}ActionClass' can be added to item and subitem respectively to change CSS on any click trigger.

View Type=Tile

  • Show More icon is added to show/hide More data.
  • On Scroll End, Next set of data will be loaded.

View Type=Table

  • To Show/Hide More data Columns can be added/removed from table by checkboxes.

View Variant=PaginationTable

  • On Scroll End, a pagination bar is shown to navigate through pages.

View Variant=Table

  • On Scroll End, Next set of data will be loaded.

Working Example

HTML

<template>
<require from="./shared/core_comp/list_pages/list_page"></require>
<div>
<cst-list-page get-data-callback.bind="getDataCallback" options.bind="options" evt-sub-item-click-callback="evtSubItemClickCallback" title.bind="title" ext-data.bind="extData"></cst-list-page>
</div>
</template>

CSS

.page-override .tile-card-view-override .subitem-override[data-value='NIT'] {
width: 100% !important;
}

JS

class MyCls{
constructor(){
this.options = {
displayItems: [
{
valueProp: 'NIT'
},
{
dataType: 'Icons',
value: [
{
id: 'Save1',
name: 'Save',
tooltip: 'Save'
},
{
id: 'Print',
name: 'Print',
tooltip: 'Print'
},
{
id: 'Phone',
name: 'Phone',
tooltip: 'Phone'
},
{
id: 'Mail',
name: 'Mail',
tooltip: 'Mail',
isHide: true
},
{
id: 'Save2',
name: 'Save',
tooltip: 'Save'
}],
valueProp: 'TopIcons',
dataTypeOptions : {
title: 'NIT',
showMoreAfterCount: 2
}
},
{
valueProp: 'TenderTitle'
},
{
label: 'Request of Tender Document To',
valueProp: 'TenderDoc',
separator: ':&nbsp;'
},
{
valueProp: 'ClosingDate',
label: 'Tender Closing Date and Time',
dataType: 'Date',
dataTypeFormat: 'DD-MM-YYYY HH:mm',
separator: ':&nbsp;'
},
{
label: 'Estimated Cost',
valueProp: 'EstimatedCost',
dataType: 'Number',
dataTypeFormat: '0,0.0',
separator: ':&nbsp;'
},
{
label: 'EMD',
valueProp: 'EMD',
dataType: 'Number',
dataTypeFormat: '0,0.0',
separator: ':&nbsp;'
},
{
label: 'Line',
valueProp: 'Line',
separator: ':&nbsp;',
IsEvtSubItemClick: true
},
{
label: 'Buyer',
valueProp: 'Buyer',
separator: ':&nbsp;'
},
{
label: 'Form Fee',
valueProp: 'FormFee',
separator: ':&nbsp;'
},
{
valueProp: 'TenderCategory',
label: 'Category of Tender',
separator: ':&nbsp;'
},
{
valueProp: 'TenderType',
label: 'Tender Type',
separator: ':&nbsp;'
},
{
valueProp: 'Region',
label: 'Region',
separator: ':&nbsp;'
}],
tableViewSerialNumHeading: 'Serial No.',
showMoreAfterCount: 6,
uniqueIdProp: 'Id'
};
this.title = {
message:'Total Tenders: 30'
};
this.extData = [];
}
evtSubItemClickCallback(overrideContext, dataObj, valueProp, icon){
}
getDataCallback(overrideContext, idArr) {
}
}
export { MyCls }

Example Screen Shots

Image of Ex

Image of Ex

Image of Ex

Image of Ex

Demo Link
Demo


Commit check list

Mark down usage
https://guides.github.com/features/mastering-markdown/