# Structure row index numbering

**URL:** <https://forum.getkirby.com/t/structure-row-index-numbering/11901>\
**Category:** Questions\
**Tags:** v2\
**Created:** [December 29, 2018, 6:25am UTC](https://forum.getkirby.com/t/structure-row-index-numbering/11901 "2018-12-29T06:25:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![farisk](https://avatars.discourse-cdn.com/v4/letter/f/f07891/32.png) [@farisk](https://forum.getkirby.com/u/farisk)\
**Post date:** [December 29, 2018, 6:25am UTC](https://forum.getkirby.com/t/structure-row-index-numbering/11901/1 "2018-12-29T06:25:21Z")

</div>

I’m not sure if this is possible in Kirby.

I have a structure type field in my projects panel. (Refer to the screenshot below)  
I was wondering if its possible to **auto-number** the rows ascendingly each time i add / remove / re-order them.

 ![1](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/9/932e17af2c0a8767b6e2604240d13d2461d79c02.jpeg)

Currently i’m numbering them manually, so that means each time i remove or reorder a row, i have to change the index number manually.

Is it possible to write something in the .yml file to see which index the row is and automatically fill the index field with it?

P.S : I’m not accessing this field on the client side, just wanted to have a neat row numbering on the panel side.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [December 29, 2018, 10:59am UTC](https://forum.getkirby.com/t/structure-row-index-numbering/11901/2 "2018-12-29T10:59:47Z")

</div>

Why do you need the index at all if it is supposed to change?

> [@Structur fieleds prefilled and readonly fields](https://forum.getkirby.com/t/structur-fieleds-prefilled-and-readonly-fields/10610/6):
>
> The default content is only created in the beginning, when there is not other content yet. It is not possible by default to add a continuous number to a new entry. You can do two things: Create a custom structure field that adds the number on clicking the add button Add the continuous number on saving using a hook.

Edit: Maybe you could use the [snippet field](https://github.com/kirby-deprecated-plugins/kirby-snippetfield) instead of the structure field, then make the index a readonly field that only displays a number via a snippet without actually storing anything (just an idea, haven’t tested this).

---

<div class="post-metadata">

**Author:** ![farisk](https://avatars.discourse-cdn.com/v4/letter/f/f07891/32.png) [@farisk](https://forum.getkirby.com/u/farisk)\
**Post date:** [December 29, 2018, 1:32pm UTC](https://forum.getkirby.com/t/structure-row-index-numbering/11901/3 "2018-12-29T13:32:27Z")

</div>

thanks for the reply. im currently trying out the snippet field plugin.

I’ve managed to link a custom snippet to the index field and display the same thing.  
but i have no idea what i should do to incrementally increase the value in the snippet. hmm

ive tried something like this in the snippet:

```
 <?php $i = 0; foreach($page->grid()->toStructure() as $gridder): ?>  
  <?= $i++ ?>
 <?php endforeach ?>

```

but im getting the increment ofr index field within each row instead:

 ![21%20PM](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/3/3a5cffcfd771764cc3ee91ad201c0a5f6125166a.png)

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [December 29, 2018, 2:22pm UTC](https://forum.getkirby.com/t/structure-row-index-numbering/11901/4 "2018-12-29T14:22:34Z")

</div>

I thought it would be possible to get the index of the item in the structure field, but for this to work, there would have to be some unique value to find the correct item within the structure.

And it seems the snippet is only shown if the field contains a value, not if it is empty. Another downside is that the value is only displayed after saving…

You can always use a hook that renumbers your index when a page is saved, but that then only happens on save as well.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [December 29, 2018, 2:58pm UTC](https://forum.getkirby.com/t/structure-row-index-numbering/11901/5 "2018-12-29T14:58:55Z")

</div>

I knew I’d seen this problem before so I searched again and found this solution: [Panel - Display the current position on structure entry (+ kirby-snippetfield)](https://forum.getkirby.com/t/panel-display-the-current-position-on-structure-entry-kirby-snippetfield/10623/6?u=texnixe)

No hooks, no fiddling…

---

<div class="post-metadata">

**Author:** ![farisk](https://avatars.discourse-cdn.com/v4/letter/f/f07891/32.png) [@farisk](https://forum.getkirby.com/u/farisk)\
**Post date:** [December 29, 2018, 3:31pm UTC](https://forum.getkirby.com/t/structure-row-index-numbering/11901/6 "2018-12-29T15:31:32Z")

</div>

Yess changing the contents of the table via css did it! Thanks @texnixe ! Have a good day!

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:25pm UTC](https://forum.getkirby.com/t/structure-row-index-numbering/11901/7 "2025-02-06T17:25:36Z")

</div>

Archived on February 6, 2025, 5:25pm UTC


