Switch a single row in table from edit mode to read mode within an action sequence?

  • 1
  • Question
  • Updated 2 months ago
  • Answered
Hi everyone,

I am trying to create a row action using the Run Multiple Actions framework. The idea is to save the changes in that row and switch it back to read mode while leaving the other unsaved rows in edit mode. Right now, I have done everything suggested in this answer https://community.skuid.com/skuid/topics/save-just-one-row-in-table and the changes from the row are saved, the problem is that the row stays in edit mode so there's no way to let the user know that the save has been completed. I think a snippet would solve this, but sadly I don't know how to code. . .

Thank you for your help!

Olya
Photo of Olya Slyusar

Olya Slyusar

  • 100 Points 100 badge 2x thumb

Posted 2 months ago

  • 1
Photo of Gregg Baxter

Gregg Baxter, Official Rep

  • 3,080 Points 3k badge 2x thumb
Hi Olya

What you could explore is using the field render enable options in the table on the specific field/s.  In combination using a Ui only field and a model action that updates the Ui only field to tell the page that the field has been edited and no longer enable also changing its background colour. I created a quick sample page based on a list of opportunities as a starting point for you to experiment with.  Just paste the following XML into a new page.


Happy Skuiding!

<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" useviewportmeta="true" showheader="true">
    <models>
        <model id="OppsModel1C" limit="20" query="true" createrowifnonefound="false" datasource="salesforce" sobject="Opportunity">
            <fields>
                <field id="Id"/>
                <field id="Name"/>
                <field id="AccountId"/>
                <field id="Account.Name"/>
                <field id="Amount"/>
                <field id="Description"/>
                <field id="EditingMode" uionly="true" displaytype="BOOLEAN" label="Editing Mode" ogdisplaytype="TEXT" defaultvaluetype="fieldvalue" defaultValue="false"/>
            </fields>
            <conditions/>
            <actions>
                <action>
                    <actions>
                        <action type="updateRow" fieldmodel="OppsModel1C" affectedrows="context" field="EditingMode" enclosevalueinquotes="false" value="true"/>
                    </actions>
                    <events>
                        <event>row.updated</event>
                    </events>
                    <fields>
                        <field>Name</field>
                    </fields>
                </action>
            </actions>
        </model>
    </models>
    <components>
        <skootable showconditions="true" showsavecancel="true" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" hideheader="false" hidefooter="false" pagesize="10" alwaysresetpagination="false" createrecords="true" model="OppsModel1C" buttonposition="" mode="edit" allowcolumnreordering="true" responsive="true" uniqueid="sk-Wi0-310">
            <fields>
                <field id="Name" uniqueid="fi-Wi0-312">
                    <renderconditions logictype="and" onhidedatabehavior="keep"/>
                    <enableconditions logictype="and">
                        <condition type="fieldvalue" operator="!=" enclosevalueinquotes="false" fieldmodel="OppsModel1C" sourcetype="fieldvalue" field="EditingMode" fieldtargetobjects="Opportunity" value="true"/>
                    </enableconditions>
                </field>
                <field id="AccountId" uniqueid="fi-Wi0-313"/>
                <field id="Account.Name" uniqueid="fi-Wi0-314">
                    <renderconditions logictype="and" onhidedatabehavior="keep"/>
                    <enableconditions/>
                </field>
                <field id="Amount" uniqueid="fi-Wi0-315"/>
                <field id="Description" uniqueid="fi-Wi0-316">
                    <renderconditions logictype="and" onhidedatabehavior="keep"/>
                    <enableconditions logictype="and"/>
                </field>
                <field id="EditingMode" hideable="true" uniqueid="fi-WiQ-631"/>
            </fields>
            <rowactions>
                <action type="multi" icon="sk-icon-edit" label="Edit">
                    <actions>
                        <action type="updateRow" fieldmodel="OppsModel1C" affectedrows="context" field="EditingMode" enclosevalueinquotes="false"/>
                    </actions>
                </action>
                <action type="delete"/>
            </rowactions>
            <massactions usefirstitemasdefault="true">
                <action type="massupdate"/>
                <action type="massdelete"/>
            </massactions>
            <views>
                <view type="standard"/>
            </views>
        </skootable>
    </components>
    <resources>
        <labels/>
        <javascript/>
        <css/>
        <actionsequences uniqueid="sk-Whx-262"/>
    </resources>
    <styles>
        <styleitem type="background" bgtype="none"/>
    </styles>
</skuidpage>
(Edited)