# Counting rows in a filtered liststore

**URL:** <https://www.ruby-forum.com/t/counting-rows-in-a-filtered-liststore/73005>\
**Category:** Ruby-Gnome 2\
**Created:** [October 20, 2006, 4:04pm UTC](https://www.ruby-forum.com/t/counting-rows-in-a-filtered-liststore/73005 "2006-10-20T16:04:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@Dobai-Pataky\_B](https://www.ruby-forum.com/u/Dobai-Pataky_B)\
**Post date:** [October 20, 2006, 4:04pm UTC](https://www.ruby-forum.com/t/counting-rows-in-a-filtered-liststore/73005/1 "2006-10-20T16:04:29Z")

</div>

hi,

i have a liststore filtered with treemodelfilter, and i’d like to inform  
the user about row counts like “filtered\_row\_count/total\_row\_count”.  
i can’t find a method for it in the docs.  
i thought, i could count them, with an i=i+1 in the model.each, but i  
was hoping for something faster.  
i asked the #gtk+ on gimpnet, they suggested iter\_n\_children with iter  
== NULL , but that was implemented in ruby-gtk2 as iter.n\_children,  
so i should position an iter to the ROOT, and then i can count it’s  
children, but how can i position the ROOT of a liststore?

i’m stuck with this one, any suggestions?

balint
