I’ve been to set focus to the search input for components that are already displayed.
For the life of me I can’t get this to work on components that are being displayed once a condition is met. ie. model X has rows where model X is the Deck component that I would like to set focus on the search input.
It’s as if something is happening after displaying the component that resets the component and the focus is lost. Frustrating to say the least.
Thoughts? Ideas?
Can we make a feature Action Framework in the Display Logic section for when a component is displayed or enabled with “Set Focus” in the action framework?
<skuid__page unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" showheader="true">
<models>
<model id="Accounts" limit="20" query="false" createrowifnonefound="false" datasource="salesforce" sobject="Account">
<fields>
<field id="Name"/>
</fields>
<conditions/>
<actions/>
</model>
</models>
<components>
<skuid__buttonSet model="Accounts" uniqueid="sk-1rnP-14674">
<groups>
<skuid__buttonGroup uniqueId="sk-1rnP-14672" displayType="detached">
<buttons>
<skuid__button label="Load Accounts" uniqueId="sk-1rnP-14673">
<actions>
<action type="requeryModels" behavior="standard">
<models>
<model>Accounts</model>
</models>
</action>
<action type="custom" snippet="setAccountSearchFocus"/>
</actions>
</skuid__button>
<skuid__button label="Run Snippet" uniqueId="sk-1rnv-23046">
<actions>
<action type="custom" snippet="setAccountSearchFocus"/>
</actions>
</skuid__button>
</buttons>
</skuid__buttonGroup>
</groups>
</skuid__buttonSet>
<skuid__table allowColumnFreezing="dragDrop" model="Accounts" uniqueid="account_search" mode="read" showSaveCancel="true" pageSize="10">
<fields>
<field id="Name" uniqueid="fi-1rnM-13005"/>
</fields>
<filtering enableSearch="true" searchMethod="server" tokenizeSearch="false" emptySearchBehavior="query"/>
<actions/>
<rowActions/>
<massActions/>
<exportProperties useTableColumns="true"/>
<sorting enable="false"/>
<renderConditions logictype="and">
<renderCondition type="fieldvalue" enclosevalueinquotes="true" fieldmodel="Accounts" sourcetype="modelproperty" nosourcerowbehavior="deactivate" sourceproperty="hasRows"/>
</renderConditions>
<styleVariantConditions/>
</skuid__table>
</components>
<resources>
<labels/>
<javascript>
<jsitem location="inlinesnippet" name="setAccountSearchFocus" cachelocation="false">var $ = skuid.$;
$('#account_search').each(function(){
$(this).find('input').first().focus();
});
</jsitem>
</javascript>
<css/>
<actionsequences/>
</resources>
<styles>
<styleitem type="background" bgtype="none"/>
</styles>
</skuid__page>