0.0.3 • Published 4 years ago

ngx-mariem-datatable v0.0.3

Weekly downloads
4
License
MIT
Repository
-
Last release
4 years ago

ngx-mariem-datatable

Advanced table extension with sorting, filtering, paging and more... for Angular apps

Usage

import { NgxMariemDatatableModule } from 'ngx-mariem-datatable';
@NgModule({
  declarations: [],
  imports: [
     NgxMariemDatatableModule
  ]
})

After importing the DatatableModule in your module:

HTML Code

 <ngx-mariem-datatable
       (onActionClicked)="onActionClicked($event)"
       [Actions]="actions"
       [datatable]="datatable"
       [displayedColomn]="displayedColomn"
 >
 </ngx-mariem-datatable>

Typescript code

A step by step series of examples that tell you how to get a development env running

Say what the step will be

  actions: datatable_action[] = [
    {
      value: "Editer",
      childrens:[
        {
          type: "edit", #the type just to identify the action on click action
          iconClass: "chevron_right"
        }
      ]
    }
  ]

And

 displayedColomn: datatable_displayedColomn[] = [
    {
      data: "id",
      value: "Id",
      type: "text",
      search: true,
      sort: true
    },
    {
      data: "name",
      value: "Nom",
      type: "text",
      search: true,
      sort: true
    },
    {
      data: "description",
      value: "Description",
      type: "text",
      search: true,
      sort: true
    }
  ]

datatable : any[] = [
   {
    id:1,
    name:"user name",
    description : "exemple description"
   },
   {
    id:2,
    name:"user",
    description : "exemple description 2"
   }
]

DOCUMENTATION

Explain how to run the automated tests for this system

Genaral functionalities

Inputs

InputTypeDescription
datatablearray of objectsList should be displayed
displayedColomndatatable_displayedColomn[]cols description
Actionsdatatable_action[]List of actions buttons
hideTheaderbooleanuse it to hide table header,false by default
searchvaluestringValue to search in datatable
textalign'left','right' or 'center'set text alignment in table,'left' by default
nothingToShowMessagestring"No results"
checkboxesbooleanallow to show checkboxes select on the left ,false by default. If true datatable items should contain id & selected columns
checkboxesMultiselectbooleanallow to select multiples rows ,true by default

Outputs

OutputDescription
datatableChangeemit datatable updated
onRowClickedwhen row clicked emit row data
onActionClickedemit action clicked information

Pagination

InputTypeDescription
paginationbooleanto enable or desable pagination, true by default
itemsPerPagenumber10 by default
maxSizenumberlimit number for page links in pager, 5 by default

Groupping rows

InputTypeDescription
regroupbybooleanto active the regrouping by option , false by default
regroupbylabelstringcolumn key that will regroup by

datatable_displayedColomn model description

datatable_displayedColomn {
  data: string ;
  template?: TemplateRef<any>;
  value: string;
  type: "text" | "checkbox" | "date" | "icon" | "customTemplate" =
    "text";
  search: boolean = false;
  sort: boolean = false;
  sorted?: boolean;
  extraData?: any;
}

datatable_action model description

datatable_action {
  // attribut to show
  value: any;
  // list of actions in that groupe
  childrens: action[];
}

action model description

action {
  // action description name
  type: string;
  // class name contains icon action
  iconClass: string;
  //to disable click on action
  disabledAttribut?: string;
}
1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

1.0.0-beta.1

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago