Removing Section form repeating Section with XCollection:Remove - InfoPath Dev
in

InfoPath Dev

Removing Section form repeating Section with XCollection:Remove

Last post 09-20-2009 09:56 AM by xfields. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 09-17-2009 07:17 AM

    • xfields
    • Not Ranked
      Male
    • Joined on 09-08-2009
    • Germany
    • Posts 20

    Removing Section form repeating Section with XCollection:Remove

    I have a repeating Section wich I control with a button with custom code in c#.

    Works fine so far. I can add sections and removeAll with the xCollection but a remove of a single section dont work.

    I bet cause Infopath dont know which but i cant figure it out.

     

    Code that works:

     To ADD:

    public void CTRL624_5_OnClick(DocActionEvent e)

    {

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

    }

    To RemoveAll

    public void CTRL625_5_OnClick(DocActionEvent e)

    {

    thisXDocument.View.ExecuteAction("xCollection::removeAll", "gruppe88_2112");

    }

     

    But a thisXDocument.View.ExecuteAction("xCollection::remove", "gruppe88_2112"); for removing just one gives me an error

  • 09-18-2009 07:08 AM In reply to

    • xfields
    • Not Ranked
      Male
    • Joined on 09-08-2009
    • Germany
    • Posts 20

    Re: Removing Section form repeating Section with XCollection:Remove

    For all have the same prob.

     The remove works when the button is directly in the section u want to remove

  • 09-18-2009 08:22 PM In reply to

    Re: Removing Section form repeating Section with XCollection:Remove

     You can use ordinary DOM manipulation to do this easily enough.  If you're using a button inside th repeating section to do this, you should be able to just use this code in the button's event handler:

    e.Source.parentNode.removeChild(e.Source);

    If you want to have a single button somewhere outside the repeating section, you'll need some way of selecting the row you want to delete, and then use that instead of e.Source.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 09-20-2009 09:56 AM In reply to

    • xfields
    • Not Ranked
      Male
    • Joined on 09-08-2009
    • Germany
    • Posts 20

    Re: Removing Section form repeating Section with XCollection:Remove

    Of course.

     

    Both ways work - i can“t see one iss more easy than the other.

     And ... U got the point - the problem when the button is outside is the way to select the row :-)

Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.