2.0.0 • Published 3 months ago

angular-fix-header-grid v2.0.0

Weekly downloads
31
License
MIT
Repository
github
Last release
3 months ago

Angular 7 Fix/Freeze Header Grid

It is a simple grid with all basic feature. It's header is fixed and body is scrollable. For hierarchical data (where there is a Parent-Child relationship), check out this Angular Tree Grid Package. If data needs to be grouped by fields then check out this ngtreegrid Package.

Demo

Click here for demo.

Donate :hearts:

Please consider a donation if it is useful to you.

Version

Choose the correct version for your application.

Angularangular-fix-header-grid
<= 81.0.4
>= 9 and < 121.1.1
>= 122.0.0

Installation

    npm i angular-fix-header-grid

Usage

Import

Import AngularFixHeaderGridModule Module in your application module.

import { AngularFixHeaderGridModule } from "angular-fix-header-grid";

Add it to your imports array.

    @NgModule({
        imports: [
        AngularFixHeaderGridModule
        ]
    })

Data

Format of the data should be like below.

  students: any[] = [
    {name: 'debabrata', age: 60, weight: 60, height: 5},
    {name: 'Omm', age: 60, weight: 60, height: 5},
    {name: 'mama', age: 60, weight: 60, height: 5},
    {name: 'tiki', age: 60, weight: 60, height: 5},
    {name: 'lipi', age: 60, weight: 60, height: 5},
    {name: 'sneha', age: 60, weight: 60, height: 5},
    {name: 'shriya', age: 60, weight: 60, height: 5}
  ];

Configs

Grid Configurations

FieldTypeDefaultDescription
data_loading_textstring'Loading...'Loading place holder. This will be displayed when data is empty.
filterbooleanfalseIt enables filter toolbar. Filter is customizable at column level.
multi_selectbooleanfalseIt enables checkbox selection.
multi_select_widthstring'auto'Width of multi-select column.
row_select_functionFunctionn/aCallback function for row Selection. Based on the return type(Boolean) of this function, Selection can be enabled/disabled for a specific row.
row_class_functionFunctionn/aCallback function for row class. A custom class can be returned which will be added to the row.
row_edit_functionFunctionn/aCallback function for edit feature. Based on the return type(Boolean) of this function, edit can be enabled/disabled for a specific row. See example for more information.
row_delete_functionFunctionn/aCallback function for delete feature. Based on the return type(Boolean) of this function, delete can be enabled/disabled for a specific row. See example for more information.
actionsObjectn/aSettings for Action column. See Below
cssObjectn/aCss class for icons. See Below
columnsObjectn/aIt is an Array. If not provided all keys of the data Array will be used as Column Headers. Please find the description below
actions
FieldTypeDefaultDescription
addbooleanfalseIt enables add feature.
editbooleanfalseIt enables edit feature.
deletebooleanfalseIt enables delete feature.
resolve_addbooleanfalseManually resolve add(after making call to server). It defaults to false. See example for more information.
resolve_editbooleanfalseManually resolve edit.
resolve_deletebooleanfalseManually resolve delete feature.
css
FieldTypeDefaultDescription
expand_classstringplusIcon class for Expand icon. Font Awesome class can be given.
collapse_classstringminusIcon class for Collapse icon. Font Awesome class can be given.
add_classstringplusIcon class for Add icon. Font Awesome class can be given.
edit_classstringeditIcon class for Edit icon. Font Awesome class can be given.
delete_classstringdeleteIcon class for Delete icon. Font Awesome class can be given.
save_classstringsaveIcon class for Save icon. Font Awesome class can be given.
cancel_classstringcancelIcon class for Cancel icon. Font Awesome class can be given.
row_selection_classstringn/aCSS Class for selected row.
header_classstringn/aCSS Class for header.
columns
FieldTypeDefaultDescription
namestringn/akey of the column.
headerstringn/aHeader of the column that will be displayed in the table.
widthstringn/aWidth of the column with unit(px/rem).
hiddenbooleanfalseShow/Hide column.
filterbooleantrueEnable/Disable filter.
editablebooleanfalseTo make a specific column editable. By default columns are not editable. edit option needs to be true at grid level.
sortablebooleanfalseTo make a specific column sortable.
rendererFunctionn/aIt is a method to render customized value for the column. See this Example.
typestring''Set to 'custom' to have custom component for the column. Otherwise leave blank.
componentObjectn/aCustom View Component. Mandatory if type is custom.See this Example.
editorObjectn/aCustom Editor Component. If given custom editor component will be used instead of default editor. See this Example.
on_component_initFunctionn/aCallback function for the column on component init.

Basic Example

    configs: any = {
        height: '300px',
        filter: true,
        columns: [
        {
            name: 'name',
            header: 'Name',
            width: '100px'
        },
        {
            name: 'age',
            header: 'Age',
            renderer: function(value) {
            return value + ' years';
            }
        }]
    };

HTML

Add below node to your html.

  <db-angular-fix-header-grid [source]="source" [configs]="configs"></db-angular-fix-header-grid>

Events

EventArgumentsDescription
expandrow_data: Expanded RowEvent fires when parent is expanded.
collapserow_data: Collapsed RowEvent fires when parent is collapsed.
cellclickevent Consist of: row: Selected Row column: Selected ColumnEvent fires when a child cell is clicked.
rowselectevent Consist of: data: Selected Row event: Event ObjectEvent fires when a row is selected.
rowdeselectevent Consist of: data: Selected Row event: Event ObjectEvent fires when a row is deselected.
rowselectallevent: Event ObjectEvent fires when select-all checkbox is checked.
rowdeselectallevent: Event ObjectEvent fires when select-all checkbox is unchecked.
rowsaveevent Consist of: data: Selected Row event: Event ObjectEvent fires when a row is saved.
rowdeleteevent Consist of: data: Selected Row event: Event ObjectEvent fires when a row is deleted.
rowaddevent Consist of: data: Selected Row event: Event ObjectEvent fires when a row is added.

Can I hire you guys?

Yes. Please contact us at debabratapatra12@gmail.com. We will be happy to work with you!

License

This project is licensed under the MIT license.

2.0.0

3 months ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

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

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago