<?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>Selection in a grid using select all and deselect All functionality</title><link>https://community.appian.com/discussions/f/user-interface/25414/selection-in-a-grid-using-select-all-and-deselect-all-functionality</link><description>HI All , 
 I am trying to select the value in a readonly grid by select all and deselect all functionality in a grid . I am not able to achieve this . below is the snippet of my code . please help me out . 
 Thanks in advance</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Selection in a grid using select all and deselect All functionality</title><link>https://community.appian.com/thread/98955?ContentTypeID=1</link><pubDate>Thu, 04 Aug 2022 03:03:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fec7e3ef-4c0e-41bd-b72f-94a6b1f9a356</guid><dc:creator>deepakg271869</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!data1: { { name: &amp;quot;Java&amp;quot; }, { name: &amp;quot;Python&amp;quot; } },
  local!selectedRowData,
  local!pageSize: 25,
  local!defaultActivityPaging: a!pagingInfo(
    1,
    local!pageSize,
    a!sortInfo(&amp;quot;name&amp;quot;, true)
  ),
  local!activityPaging: local!defaultActivityPaging,
  local!selection,
  local!isDeselectAllDisabled: or(
    length(local!data1) &amp;gt; 100,
    a!isNullOrEmpty(local!selection)
  ),
  local!isSelectAllDisabled: or(
    length(local!data1) &amp;gt; 100,
    length(local!data1) = 0
  ),
  {
    a!columnsLayout(
      columns: {
        a!columnLayout(
          contents: {
            a!richTextDisplayField(
              value: {
                a!richTextIcon(
                  icon: &amp;quot;question-circle&amp;quot;,
                  caption: &amp;quot;Selection will only apply to filtered records&amp;quot;,
                  color: &amp;quot;#1D659C&amp;quot;
                ),
                &amp;quot; &amp;quot;,
                a!richTextIcon(
                  icon: &amp;quot;square-o&amp;quot;,
                  caption: if(
                    local!isDeselectAllDisabled,
                    &amp;quot;No Records selected&amp;quot;,
                    {}
                  ),
                  color: if(
                    local!isDeselectAllDisabled,
                    {},
                    &amp;quot;ACCENT&amp;quot;
                  )
                ),
                a!richTextItem(
                  text: &amp;quot; Deselect All&amp;quot;,
                  link: if(
                    local!isDeselectAllDisabled,
                    {},
                    a!dynamicLink(
                      label: &amp;quot;Deselect All&amp;quot;,
                      saveInto: {
                        a!save(local!selection, null),
                        a!save(local!selectedRowData, null)
                      }
                    )
                  ),
                  linkStyle: &amp;quot;STANDALONE&amp;quot;
                ),
                &amp;quot; | &amp;quot;,
                a!richTextIcon(
                  icon: &amp;quot;check-square-o&amp;quot;,
                  caption: if(
                    local!isSelectAllDisabled,
                    &amp;quot;Limit filtered list below &amp;quot; &amp;amp; 100 &amp;amp; &amp;quot; records&amp;quot;,
                    {}
                  ),
                  linkStyle: &amp;quot;STANDALONE&amp;quot;,
                  color: if(local!isSelectAllDisabled, {}, &amp;quot;ACCENT&amp;quot;)
                ),
                a!richTextItem(
                  text: &amp;quot; Select All&amp;quot;,
                  link: if(
                    local!isSelectAllDisabled,
                    {},
                    a!dynamicLink(
                      label: &amp;quot;Select All&amp;quot;,
                      value: {},
                      saveInto: {
                        a!save(
                          local!selection,
                          enumerate(count(local!data1)) + 1
                        ),
                        a!save(local!selectedRowData, local!data1)
                      }
                    )
                  ),
                  linkStyle: &amp;quot;STANDALONE&amp;quot;
                )
              },
              align: &amp;quot;RIGHT&amp;quot;
            )
          }
        )
      },
      alignVertical: &amp;quot;BOTTOM&amp;quot;
    ),
    a!gridField(
      labelPosition: &amp;quot;ABOVE&amp;quot;,
      data: local!data1,
      columns: {
        a!gridColumn(
          label: &amp;quot;name&amp;quot;,
          sortField: &amp;quot;name&amp;quot;,
          value: fv!row.name,
          align: &amp;quot;START&amp;quot;
        ),
        
      },
      pagingSaveInto: local!activityPaging,
      selectable: true,
      selectionValue: local!selection,
      selectionSaveInto: {
        local!selection,
        a!save(
          local!selectedRowData,
          append(local!selectedRowData, fv!selectedRows)
        ),
        a!save(
          local!selectedRowData,
          difference(
            local!selectedRowData,
            fv!deselectedRows
          )
        ),
        
      },
      
    )
  }
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Please try this code. I made some changes in select all and deselect all functionality.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Selection in a grid using select all and deselect All functionality</title><link>https://community.appian.com/thread/98932?ContentTypeID=1</link><pubDate>Wed, 03 Aug 2022 15:56:44 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:79b09b92-7d8e-4fe2-b81f-0d45c9db822b</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;Gotcha, sorry I missed the selection links on the top right!&lt;/p&gt;
&lt;p&gt;So&amp;nbsp;the key is that the local!selection value holds the unique key of your selection, in the link you are saving the entire row to the selection.&amp;nbsp; You can see by using the select link with the issue (creates the top values in local!selection), then selecting with the checkbox in the grid (creates the bottom 2 selections):&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/13/pastedimage1659542054593v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Instead, you would save the row IDs into the selection.&amp;nbsp; As a quick example, test after changing your local!selection save on line 88 to:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;a!save(local!selection,1+enumerate(2))&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Selection in a grid using select all and deselect All functionality</title><link>https://community.appian.com/thread/98929?ContentTypeID=1</link><pubDate>Wed, 03 Aug 2022 15:31:27 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:52572650-7cb3-48a8-8e38-b6dbd1dc0b75</guid><dc:creator>saurabh sharma</dc:creator><description>&lt;p&gt;Hi Chris, when I am selecting a single value from grid , the selected row data variable works as expected . but when using select All link for selecting all data , I am not able see the selected value in grid and also the selected row data variable did not behave as expected&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Selection in a grid using select all and deselect All functionality</title><link>https://community.appian.com/thread/98928?ContentTypeID=1</link><pubDate>Wed, 03 Aug 2022 15:29:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c6bd3380-0ed8-4745-b288-bb17dc2b3cb3</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;Your code works for me for selecting/deselecting when I directly paste it into my environment.&amp;nbsp; What behavior are you seeing?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>