Closed Bug 318779 Opened 19 years ago Closed 18 years ago

index() update problem in repeat on nodeset change

Categories

(Core Graveyard :: XForms, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: apenciu, Assigned: allan)

References

Details

(Keywords: fixed1.8.0.5, fixed1.8.1)

Attachments

(1 file, 1 obsolete file)

3.54 KB, application/xhtml+xml
Details
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20051202 Firefox/1.6a1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20051202 Firefox/1.6a1

The index() of a nested repeat is not set correctly after a random number of insert/delete operations on several nested repeat elements. 

The problem occurs when using nested repeat elements (the nested repeat uses a rather complex XPath expression to filter out items marked as deleted or hidden). 

After several insert/delete cycles (items are inserted in the nested repeat for different outer repeat items), if the user alternates deleting inner items from more than one outer items the index of the nested repeat fails to be set properly (actually it is correct only for one of the nested repeat elements and does not change for the others).

An example to clarify the issue will be provided.  

Reproducible: Sometimes

Steps to Reproduce:
Using the attached test case
1. Click on "Add 10 Items" for each of the four items of the outer repeat element.
2. The middle panel should show the filtered collection while the right panel should show the unfiltered version.
3. Start deleting items (click on Delete) in the following orther:
 - first the last item (10) of Item list#4
 - then the last item (10)  of Item list#3
 - then the last item (10)  of Item list#2
 - then the last item (10)  of Item list#1
 - now delete the last item (9) of Item list#1
 - try to delete the last item (9) of Item list#2 (failed for me)
4. Check the value of the nested repeat index (second value listed in the first panel) and notice that it is not updated when clicking on Delete (as it used to happen until this point).

The problem occurs after other random insert/delete patterns the only commonality seeming to be that operations are performed on several nested repeat  elements.
Actual Results:  
The nested repeat index() is not computed properly after a number of insert/delete  operations. At this point items from the nested repeat elements cannot be referenced properly.

Expected Results:  
Be consistent. Keep setting the index properly.

The problem does not seem to exist on simple xf:repeat elements (or at least it's extremely difficult to reproduce).
Attached file Testcase (obsolete) —
As explained in the bug description.
Just skimming this, we do not actually handle repeat-index settting on insert/delete properly at all, that's bug 282828. So if you are getting correct behaviour sometimes, consider yourself lucky :) If that is what you are saying, please dupe this bug to 282828. If not, correct me and I will investigate further.
(In reply to comment #2)
> Just skimming this, we do not actually handle repeat-index settting on
> insert/delete properly at all, that's bug 282828. So if you are getting correct
> behaviour sometimes, consider yourself lucky :) If that is what you are saying,
> please dupe this bug to 282828. If not, correct me and I will investigate
> further.
> 
It's not the ::repeat-index pseudoelement (XForms 1.0 - F.2) that bothers me :-(. The index() function starts failing after "repeated abuse". The "abuse pattern" I managed to reproduce was to have a list of lists (master-detail) and keep inserting/deleting detail items into different masters. 

It looks like it's the fact that I place a delete trigger on each line and I expect that clicking on it would --as a side effect-- set both indices (master and detail) correctly (E.g. clicking on a(2,3) would set the master index to 2 and the detail index to 3). Once in a while it doesn't.

If this is indeed related to the repeat-index bug 282828 or to bug 302922 (I'll try to read the code but it will take some time) please confirm and I will definitely mark this as a duplicate.
Sorry that it has taken me so darn long to get to this!

(In reply to comment #3)
> (In reply to comment #2)
> > Just skimming this, we do not actually handle repeat-index settting on
> > insert/delete properly at all, that's bug 282828. So if you are getting correct
> > behaviour sometimes, consider yourself lucky :) If that is what you are saying,
> > please dupe this bug to 282828. If not, correct me and I will investigate
> > further.
> > 
> It's not the ::repeat-index pseudoelement (XForms 1.0 - F.2) that bothers me
> :-(. The index() function starts failing after "repeated abuse". The "abuse
> pattern" I managed to reproduce was to have a list of lists (master-detail) and
> keep inserting/deleting detail items into different masters. 
> 
> It looks like it's the fact that I place a delete trigger on each line and I
> expect that clicking on it would --as a side effect-- set both indices (master
> and detail) correctly (E.g. clicking on a(2,3) would set the master index to 2
> and the detail index to 3). Once in a while it doesn't.

Well, relying on insert and delete to set the indexes correctly is exactly what bug 282828 is about. They do not. BUT as far as I can understand, your problem is that the "Delete" buttons suddenly stop working, right?

If that is your problem then your are not hitting bug 282828, because when you click a trigger inside a repeat row, the index should be set to that repeat row because it receives focus, thus eliminating the need for insert/delete to adjust indexes. I'll look into that.
It's still there. And it does not even have to be nested repeats.
Blocks: 331209
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows XP → All
Hardware: PC → All
Summary: index() problem in nested repeat elements → index() problem in repeat elements
Attached file Revised testcase
Attachment #204821 - Attachment is obsolete: true
Summary: index() problem in repeat elements → index() update problem in repeat on nodeset change
Assignee: aaronr → allan
Status: NEW → ASSIGNED
Fixed by bug 334015
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Depends on: 334015
Resolution: --- → FIXED
Whiteboard: xf-to-branch
Keywords: fixed1.8.1
Keywords: fixed1.8.0.5
Whiteboard: xf-to-branch
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: