Closed Bug 302026 Opened 19 years ago Closed 8 years ago

Support number attribute in repeat element

Categories

(Core Graveyard :: XForms, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: stpride, Unassigned)

References

()

Details

Attachments

(3 files)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8b4) Gecko/20050725 Firefox/1.0+
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8b4) Gecko/20050725 Firefox/1.0+

Need to support number="" attribute for the <xf:repeat> element.

Reproducible: Always
Attached file testcase
Hmm, we had that discussion in another bug....
https://bugzilla.mozilla.org/show_bug.cgi?id=278209#c34, obviously I forgot to
create a bug for it :(

The spec states:
"Optional hint to the XForms Processor as to how many elements from the
collection to display."
(http://www.w3.org/TR/xforms/slice9.html#ui-repeat)

So it's not 100% a need. And it's not evident how it should be implemented either.
Blocks: 264329
Hardware: PC → All
Blocks: 322255
Blocks: 326372
Blocks: 326373
Severity: normal → enhancement
well, this might not be strictly required to be 1.0 compliant, but I think that this is an important bug with many uses and since it is mentioned in the spec (and other processors support it) then authors will want to use it.  I hope that this gets in before 1.0.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee: aaronr → xforms
repeat can show number of elements only corresponding @number attibute, the rest of elements can be available though scrollbar. We can use overflow style to show scrollbar and set width/height (it depends on repeat orientation) of repeat by using the formula repeatWidth/count*number. How does xforms other processors do?
(In reply to comment #4)
> repeat can show number of elements only corresponding @number attibute, the
> rest of elements can be available though scrollbar. We can use overflow style
> to show scrollbar and set width/height (it depends on repeat orientation) of
> repeat by using the formula repeatWidth/count*number. How does xforms other
> processors do?
> 

formsPlayer seems to be the only browser processor that supports it.  And they don't use scrollbars.  They just show the 'number' of repeat items, which will kind of scroll as you increment/decrement the index since the index repeat item has to be visible.
(In reply to comment #5)

> formsPlayer seems to be the only browser processor that supports it.  And they
> don't use scrollbars.  They just show the 'number' of repeat items, which will
> kind of scroll as you increment/decrement the index since the index repeat item
> has to be visible.
> 

Ok, the problem only is in that how to show repeat element with current index always. We can use maxheight/maxwidth to show the certain number of repeat elements. If anybody wants to see scrollbar then he can add it via css.
(In reply to comment #6)
> (In reply to comment #5)
> 
> > formsPlayer seems to be the only browser processor that supports it.  And they
> > don't use scrollbars.  They just show the 'number' of repeat items, which will
> > kind of scroll as you increment/decrement the index since the index repeat item
> > has to be visible.
> > 
> 
> Ok, the problem only is in that how to show repeat element with current index
> always. We can use maxheight/maxwidth to show the certain number of repeat
> elements. If anybody wants to see scrollbar then he can add it via css.
> 


I wouldn't mind the scroll bar approach.  But it could be confusing to the user to move the scroll position move away from where the user had it.  Which could happen if the index changed due to some interaction with another control.
It would seem that a scrollbar would be hard to manage, since the repeat items are  not styled as table-rows by default...so would it be a vertical scroll or horizontal?  Also, if there are a huge number of nodes, say 1,000's, then would the processor actually build the repeat will all nodes within the scrollable area?

Seems that just displaying the number, as formsPlayer does, and using setindex() to manage scrolling seems like the best way to achieve this, imho.
Though it may seem like it, I don't have too much time on my hands.

Thought this might be useful to the discussion of this bug.  Too bad repeat's @startindex and @number aren't xpathexprs (likewise for range's attributes).  Guess that's another matter to bring up with the WG.
(In reply to comment #10)
> Created an attachment (id=229986) [edit]
> sample implemented w/o @number, using xpath position() tests
> 
> Though it may seem like it, I don't have too much time on my hands.
> 
> Thought this might be useful to the discussion of this bug.  Too bad repeat's
> @startindex and @number aren't xpathexprs (likewise for range's attributes). 
> Guess that's another matter to bring up with the WG.
> 


Well, we should be able to allow for some dynamicity by listening for attribute changes and honoring them when they happen.  So even if @number isn't hooked to instance data, if @number were changed in the DOM, then the number of repeat rows that we showed would change (between 0 and the number of items in the nodeset).

I like your sample.  So going from that, assuming that the repeat was done using @number=3 and the up/down triggers just increased/decreased the index by one, I would think that if the index became such that the repeat item for it wasn't visible, then we'd 'spin' one position up or down to make it visible.  If the index row were already visible, then we wouldn't 'spin' at all.  Just like formsPlayer works.

We should also make sure that if a repeat has @number="3" and the nodeset only has two items that if two inserts were done that the third item would show but the fourth wouldn't.
RIP xforms
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: