How to get filtered rows out of dataView?

3,934 views
Skip to first unread message

Gyuri

unread,
Jan 26, 2011, 4:54:10 PM1/26/11
to SlickGrid
Hello,

Been working with the examples here: https://github.com/mleibman/SlickGrid/wiki/Examples

dataView.getItems() gives me the entire array, even though I used the
slider to filter the rows. This function seems to return the same
values as the underlying "data" javascript array.

I found a dataView.getFilteredAndPagedItems() but I could not get this
to work.

Any tips please?

DanielD

unread,
Jan 26, 2011, 6:46:55 PM1/26/11
to SlickGrid
There is getGroups() function. Is this what you're looking for?

Michael Leibman

unread,
Jan 26, 2011, 7:13:04 PM1/26/11
to slic...@googlegroups.com
The resulting data is available via dataView.getLength() and dataView.getItem(index).

Gyuri

unread,
Jan 27, 2011, 12:44:23 AM1/27/11
to SlickGrid
Thanks Guys.

Daniel, I am using the filtered model without groups so getGroups is
not the one :) Here is the example:
http://mleibman.github.com/SlickGrid/examples/example4-model.html

Michael, thanks that is almost there. I notice getLength looks like
this
function getLength() {
return rows.length;
}

So rows contains the currently visible elements. Is there a function
that returns the entire rows array? I can get it by getting the length
with getLength and looping with dataView.getItem(index), but something
like this would be smoother no?

function getRows() {
return rows;
}

I guess we can call this now a feature request, would be sweet to be
able to do this.

Michael Leibman

unread,
Jan 27, 2011, 1:00:18 AM1/27/11
to slic...@googlegroups.com
I've removed a direct getter for "rows" since it can easily be abused, but you can add it back if you want to - it's just 3 lines of code.

Gyuri

unread,
Jan 27, 2011, 1:19:56 AM1/27/11
to SlickGrid
Much appreciated! :) I think I will stick to the current setup in that
case, don't want any abuse :).
Reply all
Reply to author
Forward
0 new messages