Hi Alain,
Further to my email yesterday regarding issue with setindex failing to
work correctly.
I found that the problem is in the following routine.
XsltForms_repeat.prototype.setIndex = function(index) {
if (this.index !== index) {
var node = this.nodes[index - 1];
if (node) {
XsltForms_globals.openAction();
this.index = index;
this.element.node = node;
XsltForms_globals.addChange(this);
XsltForms_globals.addChange(document.getElementById(XsltForms_browser.getMeta(node.ownerDocument.documentElement,
"model")).xfElement);
XsltForms_globals.closeAction();
}
}
};
At the time this is called the nodes array has the old set of nodes
(without the new one just added via xf:insert) so it will never reset
if you are making it to the last node
Changing it to the following seems to fix the issue
XsltForms_repeat.prototype.setIndex = function(index) {
if (this.index !== index) {
this.index = index;
var node = this.nodes[index - 1];
if (node) {
XsltForms_globals.openAction();
//this.index = index;
this.element.node = node;
XsltForms_globals.addChange(this);
XsltForms_globals.addChange(document.getElementById(XsltForms_browser.getMeta(node.ownerDocument.documentElement,
"model")).xfElement);
XsltForms_globals.closeAction();
}
}
};
Not sure if you might need to add further checks e.g.
XsltForms_repeat.prototype.setIndex = function(index) {
if (this.index !== index) {
this.index = index;
if (this.index < this.nodes.length && this.nodes[index-1] ) {
XsltForms_globals.openAction();
this.element.node = this.nodes[index-1];
XsltForms_globals.addChange(this);
XsltForms_globals.addChange(document.getElementById(XsltForms_browser.getMeta(node.ownerDocument.documentElement,
"model")).xfElement);
XsltForms_globals.closeAction();
}
}
};
Regards
Steve Cameron
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support