<?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>Editable grid</title><link>https://community.appian.com/discussions/f/user-interface/17117/editable-grid</link><description>Hi, 
 I am designing a page which is having editable grid containing checkboxes(property_id). These checkboxes will be either checked or unchecked based on existing data. If I make any changes to checkbox (either checked or unchecked) 
 status(is_active</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Editable grid</title><link>https://community.appian.com/thread/67570?ContentTypeID=1</link><pubDate>Thu, 20 Jun 2019 14:23:39 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bc6ea265-61aa-4e9c-a0ef-36864f3306a4</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Ok - FYI, i believe in 19.2 your configuration for a!gridField won&amp;#39;t work (unless you change the rule name to &lt;strong&gt;a!gridField_19r1&lt;/strong&gt; to use the deprecated version).&amp;nbsp; The new version of a!gridField uses somewhat different configuration parameters and uses a!gridColumn() for its columns, and will&amp;nbsp;&lt;em&gt;not&lt;span style="text-decoration:underline;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;span style="text-decoration:underline;"&gt;&lt;/span&gt; work with a!gridTextColumn, a!gridImageColumn or any of the other legacy ones.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Editable grid</title><link>https://community.appian.com/thread/67540?ContentTypeID=1</link><pubDate>Thu, 20 Jun 2019 07:12:13 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:64754cba-0fca-4b37-8ea7-d47e6a29fe31</guid><dc:creator>husaina0001</dc:creator><description>&lt;p&gt;I am sorry, I got consfused. In this page we are not using editable grid but prior to this page we are. In this page we are updating user basic details (first name , last name etc) and associate user with selected properties. And we are using 19.2 version.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Editable grid</title><link>https://community.appian.com/thread/67507?ContentTypeID=1</link><pubDate>Wed, 19 Jun 2019 15:51:55 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8bf025d6-da09-49ed-afd2-7fa5b7110af4</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Regardless of my questions above, my best guess based on your code as posted is that you need to do something more careful in the SaveInto in your grid.&amp;nbsp; I haven&amp;#39;t tested it but I&amp;#39;m guessing the following revised code sample is close:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="java"&gt;saveInto: {
  local!gridSelection,
  
  /* now, iterate through each property and update only ones that are changed */
  a!forEach(
    local!properties.data,
    if(
      contains(
        local!gridSelection.selected,
        fv!item.property_id
      ),
      /* adjust any currently-selected entries as needed */
      if(
        fv!item.is_active,
        {},
        a!save(
          fv!item.is_active,
          true()
        )
      ),
      /* adjust any not-currently-selected entries as needed */
      if(
        fv!item.is_active,
        a!save(
          fv!item.is_active,
          false()
        )
      )
    )
  )
  
  /* a!save( */
    /* target: ri!userPropertyInfo, */
    /* value: if( */
      /* length( */
        /* local!gridSelection.selected */
      /* ) = 0, */
      /* null, */
      /* a!forEach( */
        /* items: local!gridSelection.selected, */
        /* expression: { */
          /* property_id: fv!item, */
          /* is_active: true(), */
          /* user_property_status: true() */
        /* } */
      /* ) */
    /* ) */
  /* ) */
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Editable grid</title><link>https://community.appian.com/thread/67505?ContentTypeID=1</link><pubDate>Wed, 19 Jun 2019 15:38:15 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f82d5fd4-bba2-44ee-9d12-fdd9cdb16596</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;There are a couple confusing things here.&lt;/p&gt;
&lt;p&gt;1) in your top post you say you&amp;#39;re making an editable grid, but in your sample code you&amp;#39;re using a!gridField (read-only aka paging grid) with row-selection enabled.&lt;/p&gt;
&lt;p&gt;2) you&amp;#39;re using a!localVariables which suggests you&amp;#39;re on 19.2, but the setup for your paging grid is the pre-19.2 version - can you confirm which Appian version you&amp;#39;re currently on?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Editable grid</title><link>https://community.appian.com/thread/67498?ContentTypeID=1</link><pubDate>Wed, 19 Jun 2019 14:03:05 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fe5c45f8-6920-4d55-ba10-0485697fa1e6</guid><dc:creator>husaina0001</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
 local!existingUserPropertyMappingInfo: if(
    isnull(
      ri!userId
    ),
    null,
    a!queryEntity(
      entity: cons!OR_USER_PROPERTY_INFO,
      query: a!query(
        filter: a!queryFilter(
          field: &amp;quot;user_id&amp;quot;,
          operator: &amp;quot;=&amp;quot;,
          value: ri!userId
        ),
        pagingInfo: a!pagingInfo(
          startIndex: 1,
          batchSize: - 1
        )
      )
    ).data
  ),  

  local!existingUserPropertyIds: {
    a!forEach(
      items: local!existingUserPropertyMappingInfo,
      expression: fv!item.property_id
    )
  },
  local!gridSelection: a!gridSelection(
    selected: local!existingUserPropertyIds,
    pagingInfo: a!pagingInfo(
      startIndex: 1,
      batchSize: - 1,
      sort: a!sortInfo(
        field: &amp;quot;property_name&amp;quot;,
        ascending: true
      )
    )
  ),
  local!properties: a!queryEntity(
    entity: cons!OR_PROPERTY_INFO,
    query: a!query(
      pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: - 1,
        sort: a!sortInfo(
          field: &amp;quot;property_name&amp;quot;,
          ascending: true
        )
      )
    ),
    fetchTotalCount: true
  ),
  
  
  a!sectionLayout(
    contents: {
      a!columnsLayout(
        columns: {
          a!columnLayout(
            contents: {
              a!richTextDisplayField(
                label: &amp;quot;&amp;quot;,
                labelPosition: &amp;quot;COLLAPSED&amp;quot;,
                value: {
                  a!richTextHeader(
                    text: &amp;quot;Select Properties&amp;quot;
                  )
                }
              ),
              a!gridField(
                label: &amp;quot;Select Properties&amp;quot;,
                labelPosition: &amp;quot;COLLAPSED&amp;quot;,
                totalCount: local!properties.totalCount,
                columns: {
                  a!gridTextColumn(
                    label: &amp;quot;Property Name&amp;quot;,
                    field: &amp;quot;property_name&amp;quot;,
                    data: index(
                      local!properties.data,
                      &amp;quot;property_name&amp;quot;,
                      {}
                    )
                  ),
                  a!gridTextColumn(
                    label: &amp;quot;Address&amp;quot;,
                    field: &amp;quot;address_line1&amp;quot;,
                    data: index(
                      local!properties.data,
                      &amp;quot;address_line1&amp;quot;,
                      {}
                    )
                  )
                },
                identifiers: local!properties.identifiers,
                value: local!gridSelection,
                saveInto: {
                  local!gridSelection,
                  a!save(
                    target: ri!userPropertyInfo,
                    value: if(
                      length(
                        local!gridSelection.selected
                      ) = 0,
                      null,
                      a!forEach(
                        items: local!gridSelection.selected,
                        expression: {
                          property_id: fv!item,
                          is_active: true(),
                          user_property_status: true()
                        }
                      )
                    )
                  )
                },
                selection: true,
                selectionStyle: &amp;quot;CHECKBOX&amp;quot;,
                shadeAlternateRows: true,
                rowHeader: 1
              ),
              a!textField(
                label: &amp;quot;Selected Property IDs&amp;quot;,
                value: if(
                  length(
                    local!gridSelection.selected
                  ) = 0,
                  &amp;quot;No Property selected&amp;quot;,
                  joinarray(
                    local!gridSelection.selected,
                    &amp;quot;, &amp;quot;
                  )
                ),
                readOnly: true
              )
            }
          )
        }
      ),
      a!columnsLayout(
        columns: {
          a!columnLayout(
            contents: {
              a!buttonArrayLayout(
                buttons: {
                  a!buttonWidget(
                    label: &amp;quot;Cancel&amp;quot;,
                    saveInto: {
                      a!save(
                        target: ri!actionEvent,
                        value: &amp;quot;listUsers&amp;quot;
                      ),
                      a!save(
                        target: ri!userId,
                        value: null
                      ),
                      a!save(
                        target: ri!userDetails,
                        value: null
                      )
                    },
                    style: &amp;quot;NORMAL&amp;quot;
                  ),
                  a!buttonWidget(
                    label: &amp;quot;Save&amp;quot;,
                    submit: true,
                    style: &amp;quot;PRIMARY&amp;quot;,
                    disabled: false/*,
                    saveInto: a!save(
                      target: ri!userPropertyInfo,
                      value: a!forEach(
                        items: local!existingUserPropertyMappingInfo,
                        expression: 
                          a!foreach(
                            items: ri!userPropertyInfo
                            expression:
                            if()
                          )
                        
                      )
                    )*/
                  )
                },
                align: &amp;quot;END&amp;quot;
              )
            }
          )
        }
      )
    }
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/13/pastedimage1560952995374v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Editable grid</title><link>https://community.appian.com/thread/67494?ContentTypeID=1</link><pubDate>Wed, 19 Jun 2019 12:48:51 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c99f8bd6-fa82-4659-81c9-fe5e3f4cf5e8</guid><dc:creator>Navajith K</dc:creator><description>&lt;p&gt;Can you please mention how you are displaying the data in the grid? I didn&amp;#39;t exactly get the issue that you are facing. The checkbox field should&amp;nbsp;be something similar to below code. local!isActive should be replaced with your CDT field.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;load(&lt;br /&gt; local!isActive:false(),&lt;br /&gt;a!checkboxField(&lt;br /&gt; choiceLabels: {&amp;quot;&amp;quot;},&lt;br /&gt; choiceValues: {true()},&lt;br /&gt; value: if(or(rule!APN_isBlank(local!isActive),local!isActive=false()),&amp;quot;&amp;quot;,local!isActive),&lt;br /&gt; saveInto: a!save(local!isActive,if(rule!APN_isBlank(save!value),false(),&lt;span&gt;local!isActive))&lt;/span&gt;&lt;br /&gt;)&lt;br /&gt;)&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>