<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Drag and Drop functionality on UI</title><link>https://community.appian.com/discussions/f/user-interface/14891/drag-and-drop-functionality-on-ui</link><description>Hello All, 
 
 I have requirement to implement the drag and drop functionality for the UI components. 
 For example: Lets consider we have number of BoxLayout on the same page, in each boxlayout we have few cardlayouts which containing some details. Now</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Drag and Drop functionality on UI</title><link>https://community.appian.com/thread/113349?ContentTypeID=1</link><pubDate>Fri, 26 May 2023 12:08:56 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ddce6891-80a1-4dd1-aa4b-f8ce1ffaf9c9</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;I recently implemented a click&amp;amp;click demo. Click one item to pick it, then click somewhere else to drop it.&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/13/pastedimage1685102890268v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!columns: {
    a!map(
      name: &amp;quot;TO-DO&amp;quot;,
      cards: {
        a!map(name: &amp;quot;ONE&amp;quot;, icon: &amp;quot;user&amp;quot;),
        a!map(name: &amp;quot;TWO&amp;quot;, icon: &amp;quot;helicopter&amp;quot;),
        a!map(name: &amp;quot;THREE&amp;quot;, icon: &amp;quot;cog&amp;quot;),
        a!map(name: &amp;quot;FOUR&amp;quot;, icon: &amp;quot;stethoscope&amp;quot;),
        a!map(name: &amp;quot;FIVE&amp;quot;, icon: &amp;quot;piggy-bank&amp;quot;),
        a!map(name: &amp;quot;SIX&amp;quot;, icon: &amp;quot;user-ninja&amp;quot;),
      }
    ),
    a!map(
      name: &amp;quot;DOING&amp;quot;,
      cards: {}
    ),
    a!map(
      name: &amp;quot;DONE&amp;quot;,
      cards: {}
    ),
  },
  local!pickedCard,
  local!tempCard,
  a!columnsLayout(
    showDividers: true,
    columns: a!forEach(
      items: local!columns,
      expression: a!localVariables(
        local!column: fv!item,
        local!columnIndex: fv!index,
        a!columnLayout(
          contents: {
            a!cardLayout(
              showBorder: false,
              contents: {
                a!cardLayout(
                  marginBelow: &amp;quot;STANDARD&amp;quot;,
                  showBorder: false,
                  style: &amp;quot;STANDARD&amp;quot;,
                  link: if(
                    a!isNotNullOrEmpty(local!pickedCard),
                    a!dynamicLink(
                      saveInto: {
                        a!save(
                          target: local!columns[local!pickedCard.column].cards,
                          value: remove(
                            local!columns[local!pickedCard.column].cards,
                            local!pickedCard.card
                          )
                        ),
                        a!save(
                          target: local!columns[local!columnIndex].cards,
                          value: insert(
                            local!columns[local!columnIndex].cards,
                            local!tempCard,
                            1
                          )
                        ),
                        a!save(
                          target: {local!pickedCard, local!tempCard},
                          value: null
                        )
                      }
                    ),
                    null
                  ),
                  contents: a!richTextDisplayField(
                    labelPosition: &amp;quot;COLLAPSED&amp;quot;,
                    value: a!richTextHeader(
                      text: fv!item.name
                    )
                  )
                ),
                a!forEach(
                  items: local!column.cards,
                  expression: a!cardLayout(
                    marginBelow: &amp;quot;STANDARD&amp;quot;,
                    shape: &amp;quot;ROUNDED&amp;quot;,
                    showBorder: false,
                    showShadow: true,
                    style: if(
                      a!isNotNullOrEmpty(local!pickedCard),
                      if(
                        and(
                          local!pickedCard.column = local!columnIndex,
                          local!pickedCard.card = fv!index
                        ),
                        &amp;quot;ACCENT&amp;quot;,
                        &amp;quot;NONE&amp;quot;
                      ),
                      &amp;quot;NONE&amp;quot;
                    ),
                    link: if(
                      a!isNullOrEmpty(local!pickedCard),
                      a!dynamicLink(
                        saveInto: {
                          a!save(
                            target: local!tempCard,
                            value: fv!item
                          ),
                          a!save(
                            target: local!pickedCard,
                            value: a!map(
                              column: local!columnIndex,
                              card: fv!index
                            )
                          )
                        }
                      ),
                      if(
                        and(
                          and(
                            local!pickedCard.column = local!columnIndex,
                            local!pickedCard.card = fv!index
                          ),
                        ),
                        a!dynamicLink(value: null, saveInto: local!pickedCard),
                        a!dynamicLink(
                          saveInto: {
                            a!save(
                              target: local!columns[local!pickedCard.column].cards,
                              value: remove(
                                local!columns[local!pickedCard.column].cards,
                                local!pickedCard.card
                              )
                            ),
                            a!save(
                              target: local!columns[local!columnIndex].cards,
                              value: insert(
                                local!columns[local!columnIndex].cards,
                                local!tempCard,
                                fv!index + 1
                              )
                            ),
                            a!save(
                              target: {local!pickedCard, local!tempCard},
                              value: null
                            )
                          }
                        )
                      )
                    ),
                    contents: a!sideBySideLayout(
                      items: {
                        a!sideBySideItem(
                          width: &amp;quot;MINIMIZE&amp;quot;,
                          item: a!richTextDisplayField(
                            labelPosition: &amp;quot;COLLAPSED&amp;quot;,
                            value: {
                              a!richTextIcon(
                                icon: fv!item.icon,
                              ),
                            }
                          )
                        ),
                        a!sideBySideItem(
                          item: a!paragraphField(
                            labelPosition: &amp;quot;COLLAPSED&amp;quot;,
                            value: fv!item.name,
                            saveInto: fv!item.name
                          )
                        )
                      }
                    )
                  )
                )
              }
            )
          }
        )
      )
    )
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Drag and Drop functionality on UI</title><link>https://community.appian.com/thread/113346?ContentTypeID=1</link><pubDate>Fri, 26 May 2023 11:53:25 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:baa8bc3e-cefd-4abb-b9b2-5c7b820a2d62</guid><dc:creator>Harshit Bumb (Appyzie)</dc:creator><description>&lt;p&gt;I guess what you can do it to add navigation arrows adjacent to elements that you would like to reorder and then maintain some kind of dictionary that takes care of the positioning of the elements.&amp;nbsp;&lt;br /&gt;Clicking on the arrows will move the element in the respective direction.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If the elements can only move up and down, it would be pretty straight forward, else, you&amp;#39;ll have to deal with a little more challenges.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Drag and Drop functionality on UI</title><link>https://community.appian.com/thread/113343?ContentTypeID=1</link><pubDate>Fri, 26 May 2023 11:28:26 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ec26d7bb-3ec4-4a23-a26f-02fa2bf433b5</guid><dc:creator>keiths8733</dc:creator><description>&lt;p&gt;Hi Stewart,&lt;br /&gt;We have a very similar requirement to the reordering functionality where we would like users to be able to drag and drop elements in the UI. Since your reply is a couple of years old, I was wondering if there been any additional functionality that would could&amp;nbsp;improve your original solution?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Drag and Drop functionality on UI</title><link>https://community.appian.com/thread/81870?ContentTypeID=1</link><pubDate>Thu, 20 May 2021 19:37:22 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ae10f0a0-f81f-4b7e-b1ec-42b6ac58597e</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;It needs some more work but something like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  /* some dummy test data */
  local!listLength: 50,
  local!list: fn!enumerate(local!listLength) + 1,
  local!myLongList: a!forEach(
    items: local!list,
    expression: {
      item: &amp;quot;This is item &amp;quot; &amp;amp; fv!item &amp;amp; &amp;quot; of &amp;quot; &amp;amp; local!listLength
    }
  ),
  local!datasubset: a!refreshVariable(
    value: fn!todatasubset(
      local!myLongList,
      a!pagingInfo(startIndex: 1, batchSize: - 1)
    ),
    refreshOnVarChange: { local!myLongList }
  ),
  local!selectedRows: {},
  local!selectedData: {},
  local!selectedIndexes: {},
  {
    a!gridField(
      data: local!datasubset.data,
      columns: {
        a!gridColumn(label: &amp;quot;Items&amp;quot;, value: fv!row.item),
        a!gridColumn(
          value: a!richTextDisplayField(
            value: a!richTextIcon(
              icon: if(
                fn!contains(
                  fn!tointeger(local!selectedRows),
                  fv!identifier
                ),
                &amp;quot;check-square-o&amp;quot;,
                &amp;quot;square-o&amp;quot;
              ),
              link: if(
                fn!length(local!selectedRows) = 2,
                null,
                a!dynamicLink(
                  value: fv!identifier,
                  saveInto: {
                    a!save(
                      local!selectedRows,
                      fn!union(
                        fn!append(local!selectedRows, save!value),
                        {}
                      )
                    ),
                    a!save(
                      local!selectedIndexes,
                      wherecontains(
                        local!myLongList.item[local!selectedRows],
                        local!myLongList.item
                      )
                    )
                  }
                )
              ),
              linkStyle: &amp;quot;STANDALONE&amp;quot;
            )
          ),
          width: &amp;quot;ICON&amp;quot;
        )
      }
    ),
    a!buttonLayout(
      showWhen: fn!length(local!selectedRows) = 2,
      primaryButtons: {
        a!buttonWidget(
          label: &amp;quot;Swap Rows&amp;quot;,
          saveInto: {
            a!save(
              local!selectedData,
              a!forEach(
                items: local!selectedRows,
                expression: fn!append(
                  local!selectedData,
                  local!datasubset.data[fv!item]
                )
              )
            ),
            a!save(
              local!myLongList,
              fn!remove(local!myLongList, local!selectedRows)
            ),
            a!save(local!selectedRows, {}),
            a!save(
              local!myLongList,
              fn!reduce(
                fn!insert,
                local!myLongList,
                fn!merge(
                  local!selectedData,
                  {
                    local!selectedIndexes[2] - 1,
                    local!selectedIndexes[1]
                  }
                )
              )
            ),
            a!save(
              {
                local!selectedData,
                local!selectedIndexes
              },
              {}
            )
          }
        )
      },
      secondaryButtons: {
        a!buttonWidget(
          label: &amp;quot;Clear Selection&amp;quot;,
          value: {},
          saveInto: local!selectedRows
        )
      }
    )
  }
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This allows you to pick two (and ONLY two) rows, at which point a &amp;#39;SWAP ROWS&amp;#39; button becomes enabled. When this is clicked the code removes the two rows from the array, and then inserts them again in the reverse order.&lt;/p&gt;
&lt;p&gt;The key is to store the values and their indexes, and then use this information to re-insert them at their new positions in the array.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Drag and Drop functionality on UI</title><link>https://community.appian.com/thread/81862?ContentTypeID=1</link><pubDate>Thu, 20 May 2021 16:31:01 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:cffcf72c-13ee-4af9-8d25-24dcacf8d8ac</guid><dc:creator>walkers0001</dc:creator><description>&lt;p&gt;Hi &lt;a href="/members/stewart.burchell"&gt;Stewart Burchell&lt;/a&gt;, I have a requirement where the user would like to reorder a list of dictionaries (or maybe just a list of type text).&amp;nbsp; Currently I have implemented a grid where the user can click up and down arrows, but they find this tedious as the list can be quite long.&amp;nbsp; Would the method you mentioned here be usable for a requirement like this?&amp;nbsp; If so, what would that look like?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Drag and Drop functionality on UI</title><link>https://community.appian.com/thread/66629?ContentTypeID=1</link><pubDate>Thu, 16 May 2019 09:16:26 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:867284dc-9dd2-4c91-8b48-9e7d99e1b2ac</guid><dc:creator>rudrakshakammarig</dc:creator><description>&lt;p&gt;May be its bit complicated but we can achieve your requirement ,you can place two links one is to select the place where the card needs to move and another link is to move ...so that we can make sure to move the card layout&amp;nbsp; to the desired place..!.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Madhu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Drag and Drop functionality on UI</title><link>https://community.appian.com/thread/66627?ContentTypeID=1</link><pubDate>Thu, 16 May 2019 07:59:05 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:319d1e97-3c8d-4094-abd6-aed7f38e0589</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;One option is to have the card implemented in BOTH places in your Form and use the &amp;#39;showWhen&amp;#39; attribute (set using a link) to toggle the visibility between both places. It&amp;#39;s not very flexible but it would work and be pretty straightforward to implement.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Drag and Drop functionality on UI</title><link>https://community.appian.com/thread/66625?ContentTypeID=1</link><pubDate>Thu, 16 May 2019 07:04:30 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:13137dd2-b36a-4ef5-be13-4af76873d035</guid><dc:creator>priyankag0001</dc:creator><description>&lt;p&gt;Thanks Madhu,&lt;/p&gt;
&lt;p&gt;I thought of this workaround but it will only move card one step ahead or back, I have requirement to move card directly in mentioned box.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Drag and Drop functionality on UI</title><link>https://community.appian.com/thread/66624?ContentTypeID=1</link><pubDate>Thu, 16 May 2019 06:27:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:740ed78b-9045-4156-bf43-afe3712035e4</guid><dc:creator>rudrakshakammarig</dc:creator><description>&lt;p&gt;Hi &lt;a href="/members/priyankag0001"&gt;priyankag0001&lt;/a&gt; ,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;As of now we dont have such functionality , but with some work around we can achieve this (like providing links on the card layout to move right ,move left).&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Madhu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>