power-media / prado3

Automatically exported from code.google.com/p/prado3
Other
0 stars 0 forks source link

Item count inside TRepeater and TDataList during databind #477

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
**IMPROVEMENT**

I added two methods inside IItemDataRenderer :

getItemCount()
setItemCount($value)

in order to be able to call

<# $this->ItemCount #> inside templates during the databind process.

Using items is not a viable solution since items is an internal collection of 
repeater and it's filled during databind process.

I attach all the modified files.

Original issue reported on code.google.com by marco.ba...@gmail.com on 31 Aug 2013 at 1:08

GoogleCodeExporter commented 8 years ago
Added the diff file instead.

Original comment by marco.ba...@gmail.com on 31 Aug 2013 at 1:21

Attachments:

GoogleCodeExporter commented 8 years ago
Making the item count a property of the item (and not of the container) seems a 
waste of ram to me: if i have 10k items, i will have the same information 
duplicated  10k times, one for each item in the collection.
Additionally, the idea of having the item count as a property of an item is not 
logical: what if the same item is added in two or more collections? The 
itemcount property is better suited to be a property of the collection itself.
By the way, it already exists as the getItems()->getCount() property.

Original comment by ctrlal...@gmail.com on 3 Sep 2013 at 10:45

GoogleCodeExporter commented 8 years ago
Isn't it available only at the end of the databile cycle?
Il giorno 03/set/2013 11:45, <prado3@googlecode.com> ha scritto:

Original comment by marco.ba...@gmail.com on 3 Sep 2013 at 11:01

GoogleCodeExporter commented 8 years ago
Using <%# $this->Parent->Parent->ItemCount %> (during databind) will return 0; 
using <%= $this->Parent->Parent->ItemCount %> will return the umber of items.

Original comment by ctrlal...@gmail.com on 3 Sep 2013 at 1:13

GoogleCodeExporter commented 8 years ago
Ok thanks!
Il giorno 03/set/2013 14:13, <prado3@googlecode.com> ha scritto:

Original comment by marco.ba...@gmail.com on 3 Sep 2013 at 1:20

GoogleCodeExporter commented 8 years ago

Original comment by ctrlal...@gmail.com on 3 Sep 2013 at 2:32

GoogleCodeExporter commented 8 years ago
Well, thanks anyway for your comments!

-Marco
Il giorno 03/set/2013 15:32, <prado3@googlecode.com> ha scritto:

Original comment by marco.ba...@gmail.com on 3 Sep 2013 at 2:34