Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / September 2004

Tip: Looking for answers? Try searching our database.

Adding new repeating item with buttonclick

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Eric Langland [MSFT] - 30 Aug 2004 23:13 GMT
I have a button on my form that calls the following command:
XDocument.View.ExecuteAction("xCollection::insert", "group2_1");

This works great and adds a new item at the bottom of the form. I want the
button to add a new itemn at the very top every time. Is there any way to
programatically move the new item to the top of the form?
Andrew Ma [MSFT] - 01 Sep 2004 06:06 GMT
It's a little bit more complicated than ExecuteAction but it's do-able.

Here's a code snipet for Managed Code. It should be trivial to change it to
Javascript.

thisXDocument.View.ExecuteAction("xCollection::insert", "group2_3");

IXMLDOMNode parent =
thisXDocument.DOM.selectSingleNode("/my:myFields/my:group1");

IXMLDOMNode node = parent.childNodes[parent.childNodes.length - 1];

parent.insertBefore(node, parent.childNodes[0]);

Signature

Andrew J. Ma
Software Test Engineer
Microsoft Office InfoPath
http://blogs.msdn.com/ajma
---------------------------------------
This posting is provided "As Is" with no warranties, and confers no rights.
Use of any included script sample are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
Please do not send email directly to this alias.  This alias if for
newsgroup purposes only.

>I have a button on my form that calls the following command:
> XDocument.View.ExecuteAction("xCollection::insert", "group2_1");
>
> This works great and adds a new item at the bottom of the form. I want the
> button to add a new itemn at the very top every time. Is there any way to
> programatically move the new item to the top of the form?
Eric Langland [MS] - 02 Sep 2004 21:33 GMT
Andrew,
Thanks for the help. I think I'm close but for some reason my code is not
moving the item to the top of the list. It successfully adds a new item and
then selects it but it's not moving it to the top. Any ideas?

Thanks, much appreciated.

XDocument.View.ExecuteAction("xCollection::insert", "group2_1");
var parent =
XDocument.DOM.selectSingleNode("/my:myFields/my:group1/my:group2")
XDocument.View.SelectNodes(parent)
var node = parent.childNodes[parent.childNodes.length - 1];
parent.insertBefore(node, parent.childNodes[0]);

> It's a little bit more complicated than ExecuteAction but it's do-able.
>
[quoted text clipped - 16 lines]
> > button to add a new itemn at the very top every time. Is there any way to
> > programatically move the new item to the top of the form?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.