<?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>userinterface: editable grid</title><link>https://community.appian.com/discussions/f/user-interface/24629/userinterface-editable-grid</link><description>Hi, 
 I have an editable grid where I can update the data and add new employees. So far so good. 
 When we try to click on &amp;quot;Add Employee&amp;quot;, we were able to add multiple rows to the grid successfully with proper ID number. 
 The issue is, by any chance</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: userinterface: editable grid</title><link>https://community.appian.com/thread/95214?ContentTypeID=1</link><pubDate>Wed, 18 May 2022 04:42:24 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:248db809-5e94-4379-be2d-e6bf60a2692c</guid><dc:creator>Naresh</dc:creator><description>&lt;p&gt;Yes , You need to add show when logic to your richtext icon by checking if there is any id exist for that row or not.&lt;/p&gt;
&lt;p&gt;&lt;img height="78" src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/13/pastedimage1652848884654v1.png" width="180" alt=" " /&gt;&amp;nbsp;&amp;nbsp;&lt;img height="49" src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/13/pastedimage1652848908017v2.png" width="209" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;you can see the below code.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="xml"&gt;a!localVariables(
  /*Consider this is your CDT*/
  local!employees: {
    a!map( id: 1, firstName: &amp;quot;John&amp;quot; , lastName: &amp;quot;Smith&amp;quot; ),
    a!map( id: 2, firstName: &amp;quot;John&amp;quot; , lastName: &amp;quot;Smith&amp;quot; ),
    a!map( id: 3, firstName: &amp;quot;John&amp;quot; , lastName: &amp;quot;Smith&amp;quot; )
  },
  a!formLayout(
    label: &amp;quot;Grid&amp;quot;,
    contents: {
      a!gridLayout(
        totalCount: count(local!employees),
        headerCells: {
          a!gridLayoutHeaderCell(label: &amp;quot;ID&amp;quot; ),
          a!gridLayoutHeaderCell(label: &amp;quot;First Name&amp;quot; ),
          a!gridLayoutHeaderCell(label: &amp;quot;Last Name&amp;quot; ),
          a!gridLayoutHeaderCell(label: &amp;quot;&amp;quot; )
        },
        /* Only needed when some columns need to be narrow */
        columnConfigs: {
          a!gridLayoutColumnConfig(width: &amp;quot;ICON&amp;quot;),
          a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;),
          a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&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;id&amp;quot; &amp;amp; fv!index,
                value: fv!index,
                readOnly: true
              ),
              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!richTextDisplayField(
                value: a!richTextIcon(
                  showWhen: a!isNullOrEmpty(fv!item.id),
                  icon: &amp;quot;close&amp;quot;,
                  altText: &amp;quot;delete &amp;quot; &amp;amp; fv!index,
                  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))
                    }
                  ),
                  linkStyle: &amp;quot;STANDALONE&amp;quot;,
                  color: &amp;quot;NEGATIVE&amp;quot;
                )
              )
            },
            id: fv!index
          )
        ),
        addRowlink: a!dynamicLink(
          label: &amp;quot;Add Employee&amp;quot;,
          value: {
            a!map(
              firstName: null,
              lastName: null
            )
          },
          saveInto: {
            a!save(local!employees, append(local!employees, save!value))
          }
        ),
        rowHeader: 1
      )
    },
    buttons: a!buttonLayout(
      primaryButtons: a!buttonWidget(
        label: &amp;quot;Submit&amp;quot;,
        submit: true
      )
    )
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: userinterface: editable grid</title><link>https://community.appian.com/thread/95213?ContentTypeID=1</link><pubDate>Wed, 18 May 2022 04:09:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4983609a-2610-49d6-b686-c2aebc4a7f64</guid><dc:creator>Rao2022</dc:creator><description>&lt;p&gt;Thanks for your suggested answer.&lt;/p&gt;
&lt;p&gt;I have also got one another quick question.&lt;/p&gt;
&lt;p&gt;Is there away I can&amp;nbsp;provide &amp;quot;delete&amp;quot; icon only for&amp;nbsp;the row which I have added using &amp;quot;Add Employee&amp;quot; link. I don&amp;#39;t want to provide &amp;quot;delete&amp;quot; icon for the existing/default loaded rows.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: userinterface: editable grid</title><link>https://community.appian.com/thread/95212?ContentTypeID=1</link><pubDate>Wed, 18 May 2022 04:00:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d82790ec-e04a-46a3-aed1-f6df5e3e53b5</guid><dc:creator>Naresh</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You need to pass your&amp;nbsp;current index to get updated index value. Use this sample code to updated your logic.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="xml"&gt;a!localVariables(
  /*Consider this is your CDT*/
  local!employees: {
    a!map( firstName: &amp;quot;John&amp;quot; , lastName: &amp;quot;Smith&amp;quot; ),
    a!map( firstName: &amp;quot;John&amp;quot; , lastName: &amp;quot;Smith&amp;quot; ),
    a!map( firstName: &amp;quot;John&amp;quot; , lastName: &amp;quot;Smith&amp;quot; )
  },
  a!formLayout(
    label: &amp;quot;Grid&amp;quot;,
    contents: {
      a!gridLayout(
        totalCount: count(local!employees),
        headerCells: {
          a!gridLayoutHeaderCell(label: &amp;quot;ID&amp;quot; ),
          a!gridLayoutHeaderCell(label: &amp;quot;First Name&amp;quot; ),
          a!gridLayoutHeaderCell(label: &amp;quot;Last Name&amp;quot; ),
          a!gridLayoutHeaderCell(label: &amp;quot;&amp;quot; )
        },
        /* Only needed when some columns need to be narrow */
        columnConfigs: {
          a!gridLayoutColumnConfig(width: &amp;quot;ICON&amp;quot;),
          a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;),
          a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&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;id&amp;quot; &amp;amp; fv!index,
                value: fv!index,
                readOnly: true
              ),
              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!richTextDisplayField(
                value: a!richTextIcon(
                  icon: &amp;quot;close&amp;quot;,
                  altText: &amp;quot;delete &amp;quot; &amp;amp; fv!index,
                  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))
                    }
                  ),
                  linkStyle: &amp;quot;STANDALONE&amp;quot;,
                  color: &amp;quot;NEGATIVE&amp;quot;
                )
              )
            },
            id: fv!index
          )
        ),
        addRowlink: a!dynamicLink(
          label: &amp;quot;Add Employee&amp;quot;,
          value: {
            a!map(
              firstName: null,
              lastName: null
            )
          },
          saveInto: {
            a!save(local!employees, append(local!employees, save!value))
          }
        ),
        rowHeader: 1
      )
    },
    buttons: a!buttonLayout(
      primaryButtons: a!buttonWidget(
        label: &amp;quot;Submit&amp;quot;,
        submit: true
      )
    )
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>