<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to delete rows in DropdownCommandInput in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6347594#M19844</link>
    <description>&lt;P&gt;Hello. It need delete rows in DropDownCommandInput if button delete is pressed. I try this code&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;dropDownCommandInput&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;adsk&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;core&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;DropDownCommandInput&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;cast&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;inputs&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;itemById&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;piecesListId&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;
    &lt;SPAN&gt;if&lt;/SPAN&gt; &lt;SPAN&gt;dropDownCommandInput&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;
        &lt;SPAN&gt;for&lt;/SPAN&gt; &lt;SPAN&gt;item&lt;/SPAN&gt; &lt;SPAN&gt;in&lt;/SPAN&gt; &lt;SPAN&gt;dropDownCommandInput&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;listItems&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;            
            &lt;SPAN&gt;item&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;deleteMe&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;I try delete all rows and add new rows, but only new rows are added.How delete all rows in DropDownCommandInput?&lt;/P&gt;</description>
    <pubDate>Wed, 25 May 2016 05:30:52 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-05-25T05:30:52Z</dc:date>
    <item>
      <title>How to delete rows in DropdownCommandInput</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6347594#M19844</link>
      <description>&lt;P&gt;Hello. It need delete rows in DropDownCommandInput if button delete is pressed. I try this code&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;dropDownCommandInput&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;adsk&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;core&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;DropDownCommandInput&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;cast&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;inputs&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;itemById&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;piecesListId&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;
    &lt;SPAN&gt;if&lt;/SPAN&gt; &lt;SPAN&gt;dropDownCommandInput&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;
        &lt;SPAN&gt;for&lt;/SPAN&gt; &lt;SPAN&gt;item&lt;/SPAN&gt; &lt;SPAN&gt;in&lt;/SPAN&gt; &lt;SPAN&gt;dropDownCommandInput&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;listItems&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;            
            &lt;SPAN&gt;item&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;deleteMe&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;I try delete all rows and add new rows, but only new rows are added.How delete all rows in DropDownCommandInput?&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2016 05:30:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6347594#M19844</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-25T05:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows in DropdownCommandInput</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6347679#M19845</link>
      <description>&lt;P&gt;You've gotten caught by a common Python programming error that I've made several times myself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;item.deleteMe&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;should be&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;item.deleteMe()&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your current code is just getting a reference to the deleteMe function while the second one is executing it.&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2016 06:39:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6347679#M19845</guid>
      <dc:creator>ekinsb</dc:creator>
      <dc:date>2016-05-25T06:39:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows in DropdownCommandInput</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6347852#M19846</link>
      <description>&lt;P&gt;Sorry it was my mistake. I try this code, but&amp;nbsp;one row still remain.&lt;/P&gt;&lt;PRE&gt;    dropDownCommandInput=adsk.core.DropDownCommandInput.cast(inputs.itemById(piecesListId))
    dropdownItems=dropDownCommandInput.listItems
    count=dropDownCommandInput.listItems.count
    index=count-1
    while index&amp;gt;=0:          
        row=dropDownCommandInput.listItems.item(index)
        print(row.deleteMe())
        index-=1&lt;/PRE&gt;&lt;P&gt;row.deleteMe() return False if index=0&lt;/P&gt;&lt;P&gt;how to remove last Row?&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2016 08:53:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6347852#M19846</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-25T08:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows in DropdownCommandInput</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6347934#M19847</link>
      <description>&lt;P&gt;I'm not exactly sure why your code isn't working.&amp;nbsp; I didn't take the time to debug it, but this simpler version is working for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;    dropDown = eventArgs.inputs.itemById('dropDown')&lt;BR /&gt;    for i in range(0, dropDown.listItems.count):&lt;BR /&gt;        print(dropDown.listItems.item(0).deleteMe())
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We also have it on our backlog to add a "clear" method to the ListItems class to make this much easier.&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2016 09:45:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6347934#M19847</guid>
      <dc:creator>ekinsb</dc:creator>
      <dc:date>2016-05-25T09:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows in DropdownCommandInput</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6349987#M19848</link>
      <description>&lt;PRE&gt;dropDownCommandInput = inputs.itemById(piecesListId) 
    for i in range(0, dropDownCommandInput.listItems.count): 
        print(dropDownCommandInput.listItems.item(0).deleteMe())&lt;/PRE&gt;&lt;P&gt;print False( , and no one row is not delete.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but if add Breakpoint and write in console&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;dropDownCommandInput.listItems.item(1).deleteMe()&lt;/PRE&gt;&lt;P&gt;return true&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 08:42:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6349987#M19848</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-26T08:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows in DropdownCommandInput</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6349996#M19849</link>
      <description>&lt;P&gt;I don't know what the difference could be.&amp;nbsp; I just double-checked my test and it's returning True for every delete.&amp;nbsp; What type of drop-down are you testing with?&amp;nbsp; I'm using check boxes.&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 08:48:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6349996#M19849</guid>
      <dc:creator>ekinsb</dc:creator>
      <dc:date>2016-05-26T08:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows in DropdownCommandInput</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6349997#M19850</link>
      <description>&lt;P&gt;commandInputs_.addDropDownCommandInput(piecesListId, 'Piece', adsk.core.DropDownStyles.TextListDropDownStyle);&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 08:50:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6349997#M19850</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-26T08:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows in DropdownCommandInput</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6350009#M19851</link>
      <description>&lt;P&gt;Active Row is not deleted. It need delete all old rows and&amp;nbsp;set new list of rows.&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 09:00:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6350009#M19851</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-26T09:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows in DropdownCommandInput</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6350035#M19852</link>
      <description>&lt;P&gt;I've verified the problem with a text list and also see that it's not allowing the selected item in the list to be deleted.&amp;nbsp; The only workaround I can see now is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Delete all of the items in the list except for the selected item.&lt;/P&gt;
&lt;P&gt;2. Add your new items to the list and have one them selected.&lt;/P&gt;
&lt;P&gt;3. Delete the first item in the (which will be the one left over).&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 09:22:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6350035#M19852</guid>
      <dc:creator>ekinsb</dc:creator>
      <dc:date>2016-05-26T09:22:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows in DropdownCommandInput</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6350244#M19853</link>
      <description>&lt;P&gt;No chanses :), I am crying. When in list remains&amp;nbsp;2 rows. Both rows have status isSelected=True, and no one is not deletable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;def deleteSelectedRow(inputs):
    dropDownCommandInput=adsk.core.DropDownCommandInput.cast(inputs.itemById(piecesListId))
    count =  len(dropDownCommandInput.listItems)
    first=True
    
    for piece in currentPiecesSet.pieces:

        if first==True:
            dropDownCommandInput.listItems.add(piece.name, False, '')
            first=False
        else: dropDownCommandInput.listItems.add(piece.name, False, '')
    dropDownCommandInput.listItems.item(1).isSelected=True
    
    for i in range(0, count): 

        dropDownCommandInput.listItems.item(1).isSelected=True
        dropDownCommandInput.listItems.item(0).deleteMe()
        
    print(len(dropDownCommandInput.listItems))
    &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 13:00:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6350244#M19853</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-26T13:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows in DropdownCommandInput</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6350371#M19854</link>
      <description>&lt;P&gt;code without garbage&lt;/P&gt;&lt;PRE&gt;def deleteSelectedRow(inputs):
    dropDownCommandInput=adsk.core.DropDownCommandInput.cast(inputs.itemById(piecesListId))
    count =  len(dropDownCommandInput.listItems)
 
    for piece in currentPiecesSet.pieces:
            dropDownCommandInput.listItems.add(piece.name, True, '')
    
    for i in range(0, count): 

        dropDownCommandInput.listItems.item(1).isSelected=True
        dropDownCommandInput.listItems.item(0).deleteMe()
        
    print(len(dropDownCommandInput.listItems))&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 May 2016 13:11:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6350371#M19854</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-26T13:11:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows in DropdownCommandInput</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6351653#M19855</link>
      <description>It looks like a Bug, or I am not right?</description>
      <pubDate>Fri, 27 May 2016 00:00:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6351653#M19855</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-27T00:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete rows in DropdownCommandInput</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6805550#M19856</link>
      <description>&lt;P&gt;Has this issue been fixed or a solution found? I am having exactly the same problem.&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jan 2017 11:49:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-delete-rows-in-dropdowncommandinput/m-p/6805550#M19856</guid>
      <dc:creator>SeanKane88</dc:creator>
      <dc:date>2017-01-14T11:49:19Z</dc:date>
    </item>
  </channel>
</rss>

