repeating table insert/delete row functions - InfoPath Dev
in

InfoPath Dev

repeating table insert/delete row functions

Last post 04-26-2006 03:22 AM by Shanthi Reddy. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 03-31-2006 05:04 AM

    • spudy
    • Top 150 Contributor
    • Joined on 03-23-2006
    • United Kingdom
    • Posts 67

    repeating table insert/delete row functions

    I have yet more questions.....

    I have a repeating table which is programatically populated from a selection of text boxes and dropdownlists. The repeating table has one blank row which is used to clone each new row that is added.

    I need to allow users to be able to delete rows in case they have made incorrect selections but if I allow this option in the repeating table the users are able to then delete the first row which is used to clone items. This is bad news as it can prevent adding new items.

    Is there away to protect the first row, or hide it?

    They can also see the insert row above and insert row below options which I don't want as they are done programatically.

    Any ideas?

    Spudy

    Is there
  • 03-31-2006 06:41 AM In reply to

    Re: repeating table insert/delete row functions

    Hi Spudy,
    First of all why do u need to keep that one blank row?
    You say that u r populating the repeating table programatically.

    You dont need that one blank row to clone each new row.
    U can as well delete it and then append the new rows.

    If u r still gonna keep that first blank row (for reasons I may not know) and if u want to avoid having the delete option only for that first row,
    then
    1) disable the "Delete" option by clicking the "Customise Commands" button in the Repeating Table properties dialog(or uncheck the "Allow Users to Insert and Delete rows" checkbox.)
    2)Keep a Delete button in the repeating table such that if u click on it,the corressponding row gets deleted.
    3)Hide the Delete button only for that first row.

    Actually I have a similar situation and I have done it.

    Regards,
    Abhishek
  • 03-31-2006 07:09 AM In reply to

    • spudy
    • Top 150 Contributor
    • Joined on 03-23-2006
    • United Kingdom
    • Posts 67

    Re: repeating table insert/delete row functions

    Abhishek,
    Thanks for your response.

    I would rather not have a blank row. But if a row does not exist then the row.cloneNode(true) fails with the following error:

    'null' is null or not an object

    How do I create a new row if not using clone.

    Regards
    Spudy
  • 04-02-2006 10:04 PM In reply to

    Re: repeating table insert/delete row functions

    Hi Spudy,
    It works fine for me here.I can clone and append a row even after deleting that blank row.

    Ok,If the problem still persists,Why dont u delete the first row after u finish cloning and adding all the rows?
    :))
    If u still find it tough,I will give u the sample code as to how I did it.

    Regards,
    Abhishek
  • 04-02-2006 11:11 PM In reply to

    Re: repeating table insert/delete row functions

    I have also run into this problem spudy. The problem arises in the occurence that when you programatically "add rows" and there are no rows that are actually added. Then the blank row is deleted (which is usually fine) but no rows are added back in! Next time you try to make a clone, it's not there to do it with!

    One way to get around this that I thought of (but have not actually used yet) is to make a global variable the sample node for cloning, instantiate this in the OnLoad function, and then delete all rows. This way you always have a node ready to be cloned!

    Another way to do it is to just make sure that you have some rows after you have supposedly added them back in. If there were no rows added, add the blank row.

    Hope this makes sense and helps!
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 04-04-2006 06:24 PM In reply to

    Re: repeating table insert/delete row functions

    One other option is to have a blank first row and hide it using filters. Add a filter to the repeating table/section. Choose "The expression" from the filter dropdown and then type in "position() > 1" without the qutoes. This will display all rows except the first one.
    Shiraz Cupala / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 04-10-2006 06:46 AM In reply to

    • spudy
    • Top 150 Contributor
    • Joined on 03-23-2006
    • United Kingdom
    • Posts 67

    Re: repeating table insert/delete row functions

    Thankyou Shiraz,

    That works! I had to extract the files and then edit the template.xml file to enter content into each field in the repeating group. This then prevented the null error message that kept occuring whenever I tried to clonenode. With the filter hiding this first row it is a suitable workaround.

    I have been trying to create the first row from the schema with the following:
    row = XDocument.Solution.DOM.documentElement.selectSingleNode("//xsf:view[@name='SORDetails']//xsf:xmlToEdit[@item='/my:myFields/my:SORDetails/my:RepeatingData']//xsf:editWith[@component='xCollection']//xsf:fragmentToInsert//xsf:chooseFragment@innerFragment='my:SORDetails/my:RepeatingData']/*[RepeatingData_1]");

    but alas this does not work. I am checking my xpath references but was wondering if I am on the right track?

    Thanks

    Spudy
  • 04-21-2006 09:59 PM In reply to

    Re: repeating table insert/delete row functions

    You're welcome. :) Hmm, I'm not sure what you're trying in the above. You should not have to manually update the template.xml by extracting the files. There is a little known dialog under Tools::Default Values. Here you can specify the default values for any node and if you want to have multiple default rows you can set the values for each of them. To create the multiple default rows just select the repeating node then select the dropdown and choose the command to create another row.
    Shiraz Cupala / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 04-25-2006 12:25 AM In reply to

    • spudy
    • Top 150 Contributor
    • Joined on 03-23-2006
    • United Kingdom
    • Posts 67

    Re: repeating table insert/delete row functions

    Thanks for the tools default value info. I constantly find myself woking from extracted files as this makes things just a littler clearer sometimes.

    Thanks
    Spudy
  • 04-26-2006 03:22 AM In reply to

    Re: repeating table insert/delete row functions

    One other way to clone node is to use the Sample Data DOM instead of the main DOM. this way you can delete the rows in the Main DOM and still have no issues while cloning, because the SampleData will always have it.
    Shanthi Reddy
Page 1 of 1 (10 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.