<?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>Changing Position of Item in Editable Grid</title><link>https://community.appian.com/discussions/f/user-interface/14030/changing-position-of-item-in-editable-grid</link><description>If any of you have seen the functionality in User Start Pages, I want to implement the functionality to move a line of the editable grid up or down. I think I can do it via a dynamic link but it seems like possibly an expression rule may be an easier</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Changing Position of Item in Editable Grid</title><link>https://community.appian.com/thread/69711?ContentTypeID=1</link><pubDate>Fri, 04 Oct 2019 00:16:13 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0676545c-590b-4e1a-b148-9501eae98a8c</guid><dc:creator>gilw</dc:creator><description>&lt;p&gt;Hema, Thank you so much for posting this!&amp;nbsp; I&amp;#39;ve been looking for a quick way to reorder CDTs in this way and your solution was exactly what I needed.&amp;nbsp;&amp;nbsp;&lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f44d_2D00_1f3fc.svg" title="Thumbsup tone2"&gt;&amp;#x1f44d;&amp;#x1f3fc;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Gil&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing Position of Item in Editable Grid</title><link>https://community.appian.com/thread/63593?ContentTypeID=1</link><pubDate>Fri, 21 Dec 2018 04:19:12 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1e3da662-d495-485e-83f5-ef6abb5da4e1</guid><dc:creator>Hema</dc:creator><description>&lt;p&gt;Hi Sarah,&lt;/p&gt;
&lt;p&gt;Please try the below code snippet,&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;load(
  local!employees: {
    {
      id: 1,
      firstName: &amp;quot;John&amp;quot;,
      lastName: &amp;quot;Smith&amp;quot;,
      department: &amp;quot;Engineering&amp;quot;,
      title: &amp;quot;Director&amp;quot;,
      phoneNumber: &amp;quot;555-123-4567&amp;quot;,
      startDate: today() - 360
    },
    {
      id: 2,
      firstName: &amp;quot;Michael&amp;quot;,
      lastName: &amp;quot;Johnson&amp;quot;,
      department: &amp;quot;Finance&amp;quot;,
      title: &amp;quot;Analyst&amp;quot;,
      phoneNumber: &amp;quot;555-987-6543&amp;quot;,
      startDate: today() - 360
    },
    {
      id: 3,
      firstName: &amp;quot;Mary&amp;quot;,
      lastName: &amp;quot;Reed&amp;quot;,
      department: &amp;quot;Engineering&amp;quot;,
      title: &amp;quot;Software Engineer&amp;quot;,
      phoneNumber: &amp;quot;555-456-0123&amp;quot;,
      startDate: today() - 240
    },
    
  },
  with(
    a!formLayout(
      label: &amp;quot;Grid Data&amp;quot;,
      contents: {
        a!gridLayout(
          totalCount: count(
            local!employees
          ),
          headerCells: {
            a!gridLayoutHeaderCell(
              label: &amp;quot;First Name&amp;quot;
            ),
            a!gridLayoutHeaderCell(
              label: &amp;quot;Last Name&amp;quot;
            ),
            a!gridLayoutHeaderCell(
              label: &amp;quot;Department&amp;quot;
            ),
            a!gridLayoutHeaderCell(
              label: &amp;quot;Title&amp;quot;
            ),
            a!gridLayoutHeaderCell(
              label: &amp;quot;Phone Number&amp;quot;
            ),
            a!gridLayoutHeaderCell(
              label: &amp;quot;Start Date&amp;quot;,
              align: &amp;quot;RIGHT&amp;quot;
            ),
            a!gridLayoutHeaderCell(
              label: &amp;quot;&amp;quot;
            ),
            a!gridLayoutHeaderCell(
              label: &amp;quot;&amp;quot;
            ),
            a!gridLayoutHeaderCell(
              label: &amp;quot;&amp;quot;
            )
          },
          columnConfigs: {
            a!gridLayoutColumnConfig(
              width: &amp;quot;DISTRIBUTE&amp;quot;,
              weight: 3
            ),
            a!gridLayoutColumnConfig(
              width: &amp;quot;DISTRIBUTE&amp;quot;,
              weight: 3
            ),
            a!gridLayoutColumnConfig(
              width: &amp;quot;DISTRIBUTE&amp;quot;,
              weight: 3
            ),
            a!gridLayoutColumnConfig(
              width: &amp;quot;DISTRIBUTE&amp;quot;,
              weight: 3
            ),
            a!gridLayoutColumnConfig(
              width: &amp;quot;DISTRIBUTE&amp;quot;,
              weight: 3
            ),
            a!gridLayoutColumnConfig(
              width: &amp;quot;DISTRIBUTE&amp;quot;,
              weight: 2
            ),
            a!gridLayoutColumnConfig(
              width: &amp;quot;ICON&amp;quot;
            ),
            a!gridLayoutColumnConfig(
              width: &amp;quot;ICON&amp;quot;
            ),
            a!gridLayoutColumnConfig(
              width: &amp;quot;ICON&amp;quot;
            )
          },
          rows: a!forEach(
            items: local!employees,
            expression: a!gridRowLayout(
              contents: {
                a!textField(
                  label: &amp;quot;first name &amp;quot; &amp;amp; fv!index,
                  value: fv!item.firstName,
                  saveInto: fv!item.firstName,
                  required: true
                ),
                a!textField(
                  label: &amp;quot;last name &amp;quot; &amp;amp; fv!index,
                  value: fv!item.lastName,
                  saveInto: fv!item.lastName,
                  required: true
                ),
                a!dropdownField(
                  label: &amp;quot;department &amp;quot; &amp;amp; fv!index,
                  placeholderLabel: &amp;quot;-- Select -- &amp;quot;,
                  choiceLabels: {
                    &amp;quot;Corporate&amp;quot;,
                    &amp;quot;Engineering&amp;quot;,
                    &amp;quot;Finance&amp;quot;,
                    &amp;quot;Human Resources&amp;quot;,
                    &amp;quot;Professional Services&amp;quot;,
                    &amp;quot;Sales&amp;quot;
                  },
                  choiceValues: {
                    &amp;quot;Corporate&amp;quot;,
                    &amp;quot;Engineering&amp;quot;,
                    &amp;quot;Finance&amp;quot;,
                    &amp;quot;Human Resources&amp;quot;,
                    &amp;quot;Professional Services&amp;quot;,
                    &amp;quot;Sales&amp;quot;
                  },
                  value: fv!item.department,
                  saveInto: fv!item.department,
                  required: true
                ),
                a!textField(
                  label: &amp;quot;title &amp;quot; &amp;amp; fv!index,
                  value: fv!item.title,
                  saveInto: fv!item.title,
                  required: true
                ),
                a!textField(
                  label: &amp;quot;phone number &amp;quot; &amp;amp; fv!index,
                  placeholder: &amp;quot;555-456-7890&amp;quot;,
                  value: fv!item.phoneNumber,
                  saveInto: fv!item.phoneNumber
                ),
                a!dateField(
                  label: &amp;quot;start date &amp;quot; &amp;amp; fv!index,
                  value: fv!item.startDate,
                  saveInto: fv!item.startDate,
                  required: true,
                  align: &amp;quot;RIGHT&amp;quot;
                ),
                a!imageField(
                  label: &amp;quot;delete &amp;quot; &amp;amp; fv!index,
                  images: a!documentImage(
                    document: a!iconIndicator(
                      &amp;quot;MOVE_UP&amp;quot;
                    ),
                    altText: &amp;quot;Up&amp;quot;,
                    caption: &amp;quot;Move Up &amp;quot; &amp;amp; fv!item.firstName,
                    link: a!dynamicLink(
                      value: fv!index,
                      saveInto: {
                        if(
                          fv!index = 1,
                          {},
                          {
                            a!save(
                              local!employees,
                              insert(
                                local!employees,
                                fv!item,
                                fv!index - 1
                              )
                            ),
                            a!save(
                              local!employees,
                              remove(
                                local!employees,
                                fv!index + 1
                              )
                            )
                          }
                        )
                      }
                    )
                  ),
                  size: &amp;quot;ICON&amp;quot;
                ),
                a!imageField(
                  label: &amp;quot;delete &amp;quot; &amp;amp; fv!index,
                  images: a!documentImage(
                    document: a!iconIndicator(
                      &amp;quot;MOVE_DOWN&amp;quot;
                    ),
                    altText: &amp;quot;Down&amp;quot;,
                    caption: &amp;quot;Move Down &amp;quot; &amp;amp; fv!item.firstName,
                    link: a!dynamicLink(
                      value: fv!index,
                      saveInto: {
                        if(
                          fv!index = count(
                            local!employees
                          ),
                          {},
                          {
                            a!save(
                              local!employees,
                              insert(
                                local!employees,
                                fv!item,
                                fv!index + 2
                              )
                            ),
                            a!save(
                              local!employees,
                              remove(
                                local!employees,
                                fv!index
                              )
                            )
                          }
                        )
                      }
                    )
                  ),
                  size: &amp;quot;ICON&amp;quot;
                ),
                a!imageField(
                  label: &amp;quot;delete &amp;quot; &amp;amp; fv!index,
                  images: a!documentImage(
                    document: a!iconIndicator(
                      &amp;quot;REMOVE&amp;quot;
                    ),
                    altText: &amp;quot;Remove Employee&amp;quot;,
                    caption: &amp;quot;Remove &amp;quot; &amp;amp; fv!item.firstName &amp;amp; &amp;quot; &amp;quot; &amp;amp; fv!item.lastName,
                    link: a!dynamicLink(
                      value: fv!index,
                      saveInto: {
                        a!save(
                          local!employees,
                          remove(
                            local!employees,
                            save!value
                          )
                        )
                      }
                    )
                  ),
                  size: &amp;quot;ICON&amp;quot;
                )
              },
              id: fv!index
            )
          ),
          addRowlink: a!dynamicLink(
            label: &amp;quot;Add Employee&amp;quot;,
            value: {
              startDate: today() + 1
            },
            saveInto: {
              a!save(
                local!employees,
                append(
                  local!employees,
                  save!value
                )
              )
            }
          ),
          rowHeader: 1
        )
      }
    )
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks!!!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Hema&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing Position of Item in Editable Grid</title><link>https://community.appian.com/thread/63591?ContentTypeID=1</link><pubDate>Thu, 20 Dec 2018 19:15:13 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1ee710f4-bc4e-4f1b-aeac-7db67772335c</guid><dc:creator>SarahEvelynn</dc:creator><description>Thank you for this, this is not however a method to change position in the editable grid, only how to add, update or remove the data. I want to change the orderof the data in the editable grid after it is in there.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing Position of Item in Editable Grid</title><link>https://community.appian.com/thread/63589?ContentTypeID=1</link><pubDate>Thu, 20 Dec 2018 18:51:14 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7eb65876-5dd4-4d7d-9482-a038a6ce42a9</guid><dc:creator>ankushj</dc:creator><description>load(&lt;br /&gt;
local!employees: {&lt;br /&gt;
{ id: 1, firstName: &amp;quot;John&amp;quot; , lastName: &amp;quot;Smith&amp;quot; , department: &amp;quot;Engineering&amp;quot; , title: &amp;quot;Director&amp;quot; , phoneNumber: &amp;quot;555-123-4567&amp;quot; , startDate: today()-360 },&lt;br /&gt;
{ id: 2, firstName: &amp;quot;Michael&amp;quot; , lastName: &amp;quot;Johnson&amp;quot; , department: &amp;quot;Finance&amp;quot; , title: &amp;quot;Analyst&amp;quot; , phoneNumber: &amp;quot;555-987-6543&amp;quot; , startDate: today()-360 },&lt;br /&gt;
{ id: 3, firstName: &amp;quot;Mary&amp;quot;, lastName: &amp;quot;Reed&amp;quot; , department: &amp;quot;Engineering&amp;quot; , title: &amp;quot;Software Engineer&amp;quot; , phoneNumber: &amp;quot;555-456-0123&amp;quot; , startDate: today()-240 },&lt;br /&gt;
},&lt;br /&gt;
a!formLayout(&lt;br /&gt;
label: &amp;quot;Example: Add,Update, or Remove Employee Data&amp;quot;,&lt;br /&gt;
contents: {&lt;br /&gt;
a!textField(&lt;br /&gt;
label: &amp;quot;&amp;quot;,&lt;br /&gt;
instructions: local!employees,&lt;br /&gt;
readOnly: true()&lt;br /&gt;
),&lt;br /&gt;
with(&lt;br /&gt;
a!gridLayout(&lt;br /&gt;
totalCount: count(local!employees),&lt;br /&gt;
headerCells: {&lt;br /&gt;
a!gridLayoutHeaderCell(label: &amp;quot;First Name&amp;quot; ),&lt;br /&gt;
a!gridLayoutHeaderCell(label: &amp;quot;Last Name&amp;quot; ),&lt;br /&gt;
a!gridLayoutHeaderCell(label: &amp;quot;Department&amp;quot; ),&lt;br /&gt;
a!gridLayoutHeaderCell(label: &amp;quot;Title&amp;quot; ),&lt;br /&gt;
a!gridLayoutHeaderCell(label: &amp;quot;Phone Number&amp;quot; ),&lt;br /&gt;
a!gridLayoutHeaderCell(label: &amp;quot;Start Date&amp;quot;, align: &amp;quot;RIGHT&amp;quot; ),&lt;br /&gt;
/* For the &amp;quot;Remove&amp;quot; column */&lt;br /&gt;
a!gridLayoutHeaderCell(label: &amp;quot;&amp;quot; )&lt;br /&gt;
},&lt;br /&gt;
/* Only needed when some columns need to be narrow */&lt;br /&gt;
columnConfigs: {&lt;br /&gt;
a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight:3 ),&lt;br /&gt;
a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight:3 ),&lt;br /&gt;
a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight:3 ),&lt;br /&gt;
a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight:3 ),&lt;br /&gt;
a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight:3 ),&lt;br /&gt;
a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight:2 ),&lt;br /&gt;
a!gridLayoutColumnConfig(width: &amp;quot;ICON&amp;quot;)&lt;br /&gt;
},&lt;br /&gt;
/*&lt;br /&gt;
* a!forEach() will take local!employee data and used that data to loop through an&lt;br /&gt;
* expression that creates each row.&lt;br /&gt;
*&lt;br /&gt;
* When modifying the recipe to work with your data, you only need to change:&lt;br /&gt;
* 1.) the number of fields in each row&lt;br /&gt;
* 2.) the types of fields for each column (i.e. a!textField() for text data elements)&lt;br /&gt;
* 3.) the fv!item elements. For example fv!item.firstName would change to fv!item.yourdata&lt;br /&gt;
*/&lt;br /&gt;
rows: a!forEach(&lt;br /&gt;
items: local!employees,&lt;br /&gt;
expression: a!gridRowLayout(&lt;br /&gt;
contents: {&lt;br /&gt;
/* For the First Name Column*/&lt;br /&gt;
a!textField(&lt;br /&gt;
/* Labels are not visible in grid cells but are necessary to meet accessibility requirements */&lt;br /&gt;
label: &amp;quot;first name &amp;quot; &amp;amp; fv!index,&lt;br /&gt;
value: fv!item.firstName,&lt;br /&gt;
saveInto: fv!item.firstName,&lt;br /&gt;
required: true&lt;br /&gt;
),&lt;br /&gt;
/* For the Last Name Column*/&lt;br /&gt;
a!textField(&lt;br /&gt;
label: &amp;quot;last name &amp;quot; &amp;amp; fv!index,&lt;br /&gt;
value: fv!item.lastName,&lt;br /&gt;
saveInto: fv!item.lastName,&lt;br /&gt;
required:true&lt;br /&gt;
),&lt;br /&gt;
/* For the Department Column*/&lt;br /&gt;
a!dropdownField(&lt;br /&gt;
label: &amp;quot;department &amp;quot; &amp;amp; fv!index,&lt;br /&gt;
placeholderLabel: &amp;quot;-- Select -- &amp;quot;,&lt;br /&gt;
choiceLabels: { &amp;quot;Corporate&amp;quot;, &amp;quot;Engineering&amp;quot;, &amp;quot;Finance&amp;quot;, &amp;quot;Human Resources&amp;quot;, &amp;quot;Professional Services&amp;quot;, &amp;quot;Sales&amp;quot; },&lt;br /&gt;
choiceValues: { &amp;quot;Corporate&amp;quot;, &amp;quot;Engineering&amp;quot;, &amp;quot;Finance&amp;quot;, &amp;quot;Human Resources&amp;quot;, &amp;quot;Professional Services&amp;quot;, &amp;quot;Sales&amp;quot; },&lt;br /&gt;
value: fv!item.department,&lt;br /&gt;
saveInto: fv!item.department,&lt;br /&gt;
required:true&lt;br /&gt;
),&lt;br /&gt;
/* For the Title Column*/&lt;br /&gt;
a!textField(&lt;br /&gt;
label: &amp;quot;title &amp;quot; &amp;amp; fv!index,&lt;br /&gt;
value: fv!item.title,&lt;br /&gt;
saveInto: fv!item.title,&lt;br /&gt;
required:true&lt;br /&gt;
),&lt;br /&gt;
/* For the Phone Number Column*/&lt;br /&gt;
a!textField(&lt;br /&gt;
label: &amp;quot;phone number &amp;quot; &amp;amp; fv!index,&lt;br /&gt;
placeholder:&amp;quot;555-456-7890&amp;quot;,&lt;br /&gt;
value: fv!item.phoneNumber,&lt;br /&gt;
saveInto: fv!item.phoneNumber&lt;br /&gt;
),&lt;br /&gt;
/* For the Start Date Column*/&lt;br /&gt;
a!dateField(&lt;br /&gt;
label: &amp;quot;start date &amp;quot; &amp;amp; fv!index,&lt;br /&gt;
value: fv!item.startDate,&lt;br /&gt;
saveInto: fv!item.startDate,&lt;br /&gt;
required:true,&lt;br /&gt;
align: &amp;quot;RIGHT&amp;quot;&lt;br /&gt;
),&lt;br /&gt;
/* For the Removal Column*/&lt;br /&gt;
a!imageField(&lt;br /&gt;
label: &amp;quot;delete &amp;quot; &amp;amp; fv!index,&lt;br /&gt;
images: a!documentImage(&lt;br /&gt;
document: a!iconIndicator(&amp;quot;MOVE_UP&amp;quot;),&lt;br /&gt;
altText: &amp;quot;Remove Employee&amp;quot; ,&lt;br /&gt;
caption: &amp;quot;Remove &amp;quot; &amp;amp; fv!item.firstName &amp;amp; &amp;quot; &amp;quot; &amp;amp; fv!index,&lt;br /&gt;
link: a!dynamicLink(&lt;br /&gt;
value: fv!index,&lt;br /&gt;
saveInto: {&lt;br /&gt;
if(fv!index =1,&lt;br /&gt;
{},&lt;br /&gt;
{&lt;br /&gt;
a!save(local!employees,insert(local!employees,fv!item,fv!index-1)),&lt;br /&gt;
a!save(local!employees, remove(local!employees, fv!index+1))&lt;br /&gt;
} &lt;br /&gt;
)&lt;br /&gt;
}&lt;br /&gt;
)&lt;br /&gt;
),&lt;br /&gt;
size: &amp;quot;ICON&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
},&lt;br /&gt;
id: fv!index&lt;br /&gt;
)&lt;br /&gt;
),&lt;br /&gt;
addRowlink: a!dynamicLink(&lt;br /&gt;
label: &amp;quot;Add Employee&amp;quot;,&lt;br /&gt;
/*&lt;br /&gt;
* For your use case, set the value to a blank instance of your CDT using&lt;br /&gt;
* the type constructor, e.g. type!Employee(). Only specify the field&lt;br /&gt;
* if you want to give it a default value e.g. startDate: today()+1.&lt;br /&gt;
*/&lt;br /&gt;
value: {&lt;br /&gt;
startDate: today() + 1&lt;br /&gt;
},&lt;br /&gt;
saveInto: {&lt;br /&gt;
a!save(local!employees, append(local!employees, save!value))&lt;br /&gt;
}&lt;br /&gt;
),&lt;br /&gt;
rowHeader: 1&lt;br /&gt;
)&lt;br /&gt;
)&lt;br /&gt;
},&lt;br /&gt;
buttons: a!buttonLayout(&lt;br /&gt;
primaryButtons: a!buttonWidget(&lt;br /&gt;
label: &amp;quot;Submit&amp;quot;,&lt;br /&gt;
submit: true&lt;br /&gt;
)&lt;br /&gt;
)&lt;br /&gt;
)&lt;br /&gt;
)&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>