PDA

View Full Version : Proposal for skipping first/last records



KimH
1 Mar 2007, 1:25 PM
Hi!

I wan't to propose that 4 options is added to the (I guess) Data Store...

skipFirst : [true|false|<number>]
skipLast : [true|false|<number>]
skipFirstInSet : [true|false|<number>]
skipLastInSet : [true|false|<number>]

Explanation:
skipFirst and skipLast is working on the total record set (across paging).
skipFirstInSet and skipLastInSet is working on the first and last row(s) in a paging set.

If any of these options is set to...
true then the data store should not handle the first and/or last 1 record.
false then the data store should (the default) handle the first and/or last 1 record.
<number> then the data store should not handle the first and/or last n records.

The "readers" have a for-loop that looks like:
for (var i = 0; i < root.length - 1; i++) { ... }
it should be changed to something like:
for (var i = 0 + skipFirstNumberOfRecords; i < root.length - 1 - skipLastNumberOfRecords; i++) { ... }

I'm aware that this example does not destinguess between total records and records in a paging set.

If this is implemented it will make my coding a lot easier as I have to retrieve content from a third-party that have some dummy records before and after the desired content.

JeffHowden
1 Mar 2007, 1:34 PM
While more work for you initially, I'd suggest that custom functionality like this is a prime candidate for a custom proxy and/or reader.

Animal
1 Mar 2007, 11:30 PM
The simplest way would be a createInterceptor on the reader's "read(response)" method.