{"id":16124362,"url":"https://github.com/jongacnik/kirby2-index-field","last_synced_at":"2025-06-27T22:06:34.622Z","repository":{"id":68335739,"uuid":"99874083","full_name":"jongacnik/kirby2-index-field","owner":"jongacnik","description":"Kirby field for displaying pages as a datatable","archived":false,"fork":false,"pushed_at":"2018-11-08T19:18:39.000Z","size":1621,"stargazers_count":87,"open_issues_count":4,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-02T15:38:17.911Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jongacnik.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-10T02:51:02.000Z","updated_at":"2022-02-13T21:52:58.000Z","dependencies_parsed_at":"2023-04-28T08:52:52.633Z","dependency_job_id":null,"html_url":"https://github.com/jongacnik/kirby2-index-field","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jongacnik/kirby2-index-field","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongacnik%2Fkirby2-index-field","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongacnik%2Fkirby2-index-field/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongacnik%2Fkirby2-index-field/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongacnik%2Fkirby2-index-field/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jongacnik","download_url":"https://codeload.github.com/jongacnik/kirby2-index-field/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongacnik%2Fkirby2-index-field/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262341617,"owners_count":23296069,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-09T21:20:47.831Z","updated_at":"2025-06-27T22:06:34.600Z","avatar_url":"https://github.com/jongacnik.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kirby Index Field\n\nKirby field which displays pages (or files) as a [datatable](https://datatables.net/).\n\nThis is useful for navigating large-ish sets of items with filtering and sorting. Enables Kirby to be used a little more like a database. Pairs nicely with [kirby-hidebar-field](https://github.com/jongacnik/kirby-hidebar-field).\n\n![Preview](https://github.com/jongacnik/kirby-index-field/blob/master/preview.png?raw=true)\n\n## Examples\n\nShow an index of pages children:\n\n```yaml\npageindex:\n  label: Items\n  type: index\n  options: children\n```\n\nShow an index of pages files:\n\n```yaml\npageindex:\n  label: Items\n  type: index\n  options: files\n```\n\n## Options\n\nSimilar to Kirby's [Select Field](https://getkirby.com/docs/cheatsheet/panel-fields/select), you use the `options` parameter to specify what the index should be populated with. All Dynamic Options from the Select Field can be used:\n\nOption | Description\n--- | ---\nchildren  | Index of all children\nvisibleChildren | Index of all visible children\ninvisibleChildren | Index of all invisible children\ngrandchildren | Index of all grandchildren\nvisibleGrandchildren | Index of all visible grandchildren\ninvisibleGrandchildren | Index of all invisible grandchildren\nsiblings | Index of all siblings\nvisibleSiblings | Index of all visible siblings\ninvisibleSiblings | Index of all invisible siblings\nindex | Index of all descendants\npages | Index of all pages of the site\nfiles | Index of all files of the page\nimages | Index of all images of the page\ndocuments | Index of all documents of the page\nvideos | Index of all videos of the page\naudio | Index of all audio files of the page\ncode | Index of all code files of the page\narchives | Index of all archives of the page\n\n## Query\n\nThe Index Field also supports a version of the Select Field `query` parameter to generate more complex indexes of pages/files:\n\n```yaml\npageindex:\n  label: Items\n  type: index\n  options: query\n  query:\n    page: blog\n    fetch: children\n    template: article\n```\n\nWhere `page` is the [uid](https://getkirby.com/docs/cheatsheet/page/uid) of the desired page, and `fetch` is one of the [`options`](#options) above.\n\n## Columns\n\nBy default, only a Title column (showing a page `title` or file `filename`) will be shown. You specify what columns should appear using the `columns` parameter. The first column determines the initial sort.\n\n```yaml\npageindex:\n  label: Items\n  type: index\n  options: children\n  columns:\n    title: Title\n    date: Date\n    uid: Slug\n```\n\nThe key specifies which property of the [page/file json](https://getkirby.com/docs/cheatsheet/page/to-json) should be fetched. The value specifies the title of the column. The following example will show a column labeled **Title** and the property `title` from each item's json representation:\n\n```yaml\ntitle: Title\n```\n\n### Column Options:\n\nYou can set a few options on a per column basis.\n\n#### Column Width\n\n```yaml\ncolumns:\n  title:\n    label: Title\n    width: 100\n  uid: Slug\n```\n\n#### Column Class\n\n```yaml\ncolumns:\n  title:\n    label: Title\n    class: classname\n  uid: Slug\n```\n\n#### Column Sort-ability\n\n```yaml\ncolumns:\n  title:\n    label: Title\n    sort: false\n  uid: Slug\n```\n\n#### Column Visibility\n\n```yaml\ncolumns:\n  title:\n    label: Title\n    visible: false\n  uid: Slug\n```\n\n## Filter Data\n\nA custom filter can be applied to the data before it is put out as a json response. This is perfect if you need to modify some of the data for presentation, change columns, etc.\n\nCreate a simple plugin `site/plugins/mydatafilters/mydatafilters.php`:\n```php\n\u003c?php\n\nclass MyDataFilters {\n  static function myfilterfunc($data) {\n    // filter data here\n    return $data;\n  }\n}\n```\n\nUpdate field definition:\n```yaml\npageindex:\n  label: Items\n  type: index\n  options: children\n  filter: MyDataFilters::myfilterfunc\n  columns:\n    title: Title\n    date: Date\n    uid: Slug\n```\n\n## Rows\n\nSet the initial number of rows in the datatable:\n\n```yaml\nrows: 25\n```\n\n## Order\n\nSet the initial sort order of the first column:\n\n```yaml\norder: desc\n```\n\n## Add/Edit Links\n\nWhen showing an index of subpages (`children`, `visibleChildren` or `invisibleChildren`), Edit/Add links will appear next to the field label. You can disable these links using the `addedit` parameter:\n\n```yaml\naddedit: false\n```\n\nThese links appear on an index of subpages so you are able to [hide the subpage](https://getkirby.com/docs/panel/blueprints/subpages-settings#hide-subpages) list in the left column of the panel, or [remove the left column](https://github.com/jongacnik/kirby-hidebar-field) entirely.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjongacnik%2Fkirby2-index-field","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjongacnik%2Fkirby2-index-field","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjongacnik%2Fkirby2-index-field/lists"}