Skip to content

stepapo/dataset

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Dataset

Component for Nette Framework, that helps generate datasets from Nextras ORM collections with paging, sorting and filtering capability. The docs show basic example and ways of configuring datasets.

Example

Let's create a list of all persons in database sorted alphabeticaly by name. The list shows 10 items per page, is sortable by name, birthday and filterable by gender. Name contains a link to person's detail page. It is possible to switch between table view and grid view.

Definition

collection: %collection%
repository: %repository%
itemsPerPage: 10
columns:
    fullname:
        label: Name
        link:
            destination: PersonDetail:deafult
            args:
                id: id
        sort:
            isDefault: true
    gender:
        label: Gender
        columnName: genderLabel
        filter:
            options: %genderFilterOptions%
            prompt: Both        
    birthday:
        label: Birthday
        align: right
        latteFilter:
            name: date
            args: j. n. Y
        sort:
views:
    table:
    grid:

Component

public function createComponentPersonDataset()
{
    return Stepapo\Dataset\Control\Dataset::createFromNeon(__DIR__ . '/personDataset.neon', [
        'collection' => $this->orm->personRepository->findAll()
        'repository' => $this->orm->personRepository
        'genderFilterOptions' => ['m' => 'Male', 'f' => 'Female']
    ]);
}

Template

{control personDataset}

Configuration

Dataset

collection:
repository:
parentEntity:
itemsPerPage:
translator:
imageStorage:
itemClassCallback:
itemLink: # include Link configuration
idColumnName:
alwaysRetrieveItems:
columns:
    example column: # include Column configuration
     another example column: # include Column configuration
views:
    table: # include View configuration
    list: # include View configuration
text: # include Text configuration
search: # include Search configuration

Column

label:
description:
width:
align:
columnName:
prepend:
append:
valueTemplateFile:
hide:
class:
filter: # include Filter configuration
sort: # include Sort configuration
latteFilter: # include LatteFilter configuration
link: # include Link configuration

View

label:
datasetTemplate:
itemListTemplate:
itemTemplate:
valueTemplate:
filterListTemplate:
filterTemplate:
paginationTemplate:
sortingTemplate:
displayTemplate:
searchTemplate:
itemFactoryCallback:
isDefault:

Search

placeholder:
prepareCallback:
suggestCallback:
searchFunction: # include OrmFunction configuration
sortFunction: # include OrmFunction configuration 

Text

search:
sort:
display:
previous:
next:
noResults:
searchResults:
didYouMean:

Filter

prompt:
collapse:
columnName:
function:
hide:
options:
    example option: # include Option configuration
    another example option: # include Option configuration

Sort

idDefault:
direction:
function: # include OrmFunction configuration

Link

destination:
args:

LatteFilter

name:
args:

Option

name:
label:
condition:

OrmFunction

class:
args:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published