update design attribute value dynamically

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
2
down vote

favorite
1












Is there a way to update a 'defaul' or manually entered design attribute value?



For example,
enter image description here



component.cmp



 <aura:component implements="forceCommunity:availableForAllPageTypes" access="global" >
<aura:attribute name="someString" type="string" default="myString"/>

<lightning:input aura:id="inputString" name="someString" label="change someString Attribute" value="!v.someString"/>

<lightning:button variant="brand" label="update someString attribute" onclick="! c.handleClick "/>

<div>value should be:</div>
<div>!v.someString</div>

</aura:component>


controller.js



(
handleClick : function(component, event, helper)
const newValue = component.find('inputString').get("v.value");
component.set('v.someString', newValue);

)


design file



<design:component>
<design:attribute name="someString" description="want to update"/>
</design:component>


Why all the hassle?




I implemented a set of templates a user can select from from a
lightning component, however, since all the logic is client side, the
state resets itself as soon as I refresh the page (to be expected), I
was wondering if, without apex, there was a way of changing the set
designed attribute value.











share|improve this question





























    up vote
    2
    down vote

    favorite
    1












    Is there a way to update a 'defaul' or manually entered design attribute value?



    For example,
    enter image description here



    component.cmp



     <aura:component implements="forceCommunity:availableForAllPageTypes" access="global" >
    <aura:attribute name="someString" type="string" default="myString"/>

    <lightning:input aura:id="inputString" name="someString" label="change someString Attribute" value="!v.someString"/>

    <lightning:button variant="brand" label="update someString attribute" onclick="! c.handleClick "/>

    <div>value should be:</div>
    <div>!v.someString</div>

    </aura:component>


    controller.js



    (
    handleClick : function(component, event, helper)
    const newValue = component.find('inputString').get("v.value");
    component.set('v.someString', newValue);

    )


    design file



    <design:component>
    <design:attribute name="someString" description="want to update"/>
    </design:component>


    Why all the hassle?




    I implemented a set of templates a user can select from from a
    lightning component, however, since all the logic is client side, the
    state resets itself as soon as I refresh the page (to be expected), I
    was wondering if, without apex, there was a way of changing the set
    designed attribute value.











    share|improve this question

























      up vote
      2
      down vote

      favorite
      1









      up vote
      2
      down vote

      favorite
      1






      1





      Is there a way to update a 'defaul' or manually entered design attribute value?



      For example,
      enter image description here



      component.cmp



       <aura:component implements="forceCommunity:availableForAllPageTypes" access="global" >
      <aura:attribute name="someString" type="string" default="myString"/>

      <lightning:input aura:id="inputString" name="someString" label="change someString Attribute" value="!v.someString"/>

      <lightning:button variant="brand" label="update someString attribute" onclick="! c.handleClick "/>

      <div>value should be:</div>
      <div>!v.someString</div>

      </aura:component>


      controller.js



      (
      handleClick : function(component, event, helper)
      const newValue = component.find('inputString').get("v.value");
      component.set('v.someString', newValue);

      )


      design file



      <design:component>
      <design:attribute name="someString" description="want to update"/>
      </design:component>


      Why all the hassle?




      I implemented a set of templates a user can select from from a
      lightning component, however, since all the logic is client side, the
      state resets itself as soon as I refresh the page (to be expected), I
      was wondering if, without apex, there was a way of changing the set
      designed attribute value.











      share|improve this question















      Is there a way to update a 'defaul' or manually entered design attribute value?



      For example,
      enter image description here



      component.cmp



       <aura:component implements="forceCommunity:availableForAllPageTypes" access="global" >
      <aura:attribute name="someString" type="string" default="myString"/>

      <lightning:input aura:id="inputString" name="someString" label="change someString Attribute" value="!v.someString"/>

      <lightning:button variant="brand" label="update someString attribute" onclick="! c.handleClick "/>

      <div>value should be:</div>
      <div>!v.someString</div>

      </aura:component>


      controller.js



      (
      handleClick : function(component, event, helper)
      const newValue = component.find('inputString').get("v.value");
      component.set('v.someString', newValue);

      )


      design file



      <design:component>
      <design:attribute name="someString" description="want to update"/>
      </design:component>


      Why all the hassle?




      I implemented a set of templates a user can select from from a
      lightning component, however, since all the logic is client side, the
      state resets itself as soon as I refresh the page (to be expected), I
      was wondering if, without apex, there was a way of changing the set
      designed attribute value.








      lightning-components design-attributes






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 5 hours ago

























      asked 6 hours ago









      glls

      9,91961945




      9,91961945




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          You can dynamically change the options available in a design attribute -- at least picklist attributes -- by extending the VisualEditor.DynamicPickList class, but there isn't a way to change a value that was entered in Lightning App Builder. (You can manipulate the value once the component loads, but that won't change the value you'll see in the App Builder.)






          share|improve this answer




















          • that has been my experience so far - not sure if there is/was a way of achieving this, guess im going to have to add some apex or server side controller to manage whatis displayed then.
            – glls
            5 hours ago










          • So what's the requirement you're trying to solve for?
            – Shane Steinfeld
            5 hours ago






          • 1




            i implemented a set of templates a user can select from from the lightning community builder, however, since all the logic is client side, the state resets itself as soon as i refresh the page, i was wondering if, without apex, there was a way of changing the set designed attribute value
            – glls
            5 hours ago











          • Interesting idea! So the problem is that the template selection is done inside the component, instead of in Community Builder, is that right?
            – Shane Steinfeld
            5 hours ago










          • _exactly that _
            – glls
            5 hours ago










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "459"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f234419%2fupdate-design-attribute-value-dynamically%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          3
          down vote



          accepted










          You can dynamically change the options available in a design attribute -- at least picklist attributes -- by extending the VisualEditor.DynamicPickList class, but there isn't a way to change a value that was entered in Lightning App Builder. (You can manipulate the value once the component loads, but that won't change the value you'll see in the App Builder.)






          share|improve this answer




















          • that has been my experience so far - not sure if there is/was a way of achieving this, guess im going to have to add some apex or server side controller to manage whatis displayed then.
            – glls
            5 hours ago










          • So what's the requirement you're trying to solve for?
            – Shane Steinfeld
            5 hours ago






          • 1




            i implemented a set of templates a user can select from from the lightning community builder, however, since all the logic is client side, the state resets itself as soon as i refresh the page, i was wondering if, without apex, there was a way of changing the set designed attribute value
            – glls
            5 hours ago











          • Interesting idea! So the problem is that the template selection is done inside the component, instead of in Community Builder, is that right?
            – Shane Steinfeld
            5 hours ago










          • _exactly that _
            – glls
            5 hours ago














          up vote
          3
          down vote



          accepted










          You can dynamically change the options available in a design attribute -- at least picklist attributes -- by extending the VisualEditor.DynamicPickList class, but there isn't a way to change a value that was entered in Lightning App Builder. (You can manipulate the value once the component loads, but that won't change the value you'll see in the App Builder.)






          share|improve this answer




















          • that has been my experience so far - not sure if there is/was a way of achieving this, guess im going to have to add some apex or server side controller to manage whatis displayed then.
            – glls
            5 hours ago










          • So what's the requirement you're trying to solve for?
            – Shane Steinfeld
            5 hours ago






          • 1




            i implemented a set of templates a user can select from from the lightning community builder, however, since all the logic is client side, the state resets itself as soon as i refresh the page, i was wondering if, without apex, there was a way of changing the set designed attribute value
            – glls
            5 hours ago











          • Interesting idea! So the problem is that the template selection is done inside the component, instead of in Community Builder, is that right?
            – Shane Steinfeld
            5 hours ago










          • _exactly that _
            – glls
            5 hours ago












          up vote
          3
          down vote



          accepted







          up vote
          3
          down vote



          accepted






          You can dynamically change the options available in a design attribute -- at least picklist attributes -- by extending the VisualEditor.DynamicPickList class, but there isn't a way to change a value that was entered in Lightning App Builder. (You can manipulate the value once the component loads, but that won't change the value you'll see in the App Builder.)






          share|improve this answer












          You can dynamically change the options available in a design attribute -- at least picklist attributes -- by extending the VisualEditor.DynamicPickList class, but there isn't a way to change a value that was entered in Lightning App Builder. (You can manipulate the value once the component loads, but that won't change the value you'll see in the App Builder.)







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 5 hours ago









          Shane Steinfeld

          1,247418




          1,247418











          • that has been my experience so far - not sure if there is/was a way of achieving this, guess im going to have to add some apex or server side controller to manage whatis displayed then.
            – glls
            5 hours ago










          • So what's the requirement you're trying to solve for?
            – Shane Steinfeld
            5 hours ago






          • 1




            i implemented a set of templates a user can select from from the lightning community builder, however, since all the logic is client side, the state resets itself as soon as i refresh the page, i was wondering if, without apex, there was a way of changing the set designed attribute value
            – glls
            5 hours ago











          • Interesting idea! So the problem is that the template selection is done inside the component, instead of in Community Builder, is that right?
            – Shane Steinfeld
            5 hours ago










          • _exactly that _
            – glls
            5 hours ago
















          • that has been my experience so far - not sure if there is/was a way of achieving this, guess im going to have to add some apex or server side controller to manage whatis displayed then.
            – glls
            5 hours ago










          • So what's the requirement you're trying to solve for?
            – Shane Steinfeld
            5 hours ago






          • 1




            i implemented a set of templates a user can select from from the lightning community builder, however, since all the logic is client side, the state resets itself as soon as i refresh the page, i was wondering if, without apex, there was a way of changing the set designed attribute value
            – glls
            5 hours ago











          • Interesting idea! So the problem is that the template selection is done inside the component, instead of in Community Builder, is that right?
            – Shane Steinfeld
            5 hours ago










          • _exactly that _
            – glls
            5 hours ago















          that has been my experience so far - not sure if there is/was a way of achieving this, guess im going to have to add some apex or server side controller to manage whatis displayed then.
          – glls
          5 hours ago




          that has been my experience so far - not sure if there is/was a way of achieving this, guess im going to have to add some apex or server side controller to manage whatis displayed then.
          – glls
          5 hours ago












          So what's the requirement you're trying to solve for?
          – Shane Steinfeld
          5 hours ago




          So what's the requirement you're trying to solve for?
          – Shane Steinfeld
          5 hours ago




          1




          1




          i implemented a set of templates a user can select from from the lightning community builder, however, since all the logic is client side, the state resets itself as soon as i refresh the page, i was wondering if, without apex, there was a way of changing the set designed attribute value
          – glls
          5 hours ago





          i implemented a set of templates a user can select from from the lightning community builder, however, since all the logic is client side, the state resets itself as soon as i refresh the page, i was wondering if, without apex, there was a way of changing the set designed attribute value
          – glls
          5 hours ago













          Interesting idea! So the problem is that the template selection is done inside the component, instead of in Community Builder, is that right?
          – Shane Steinfeld
          5 hours ago




          Interesting idea! So the problem is that the template selection is done inside the component, instead of in Community Builder, is that right?
          – Shane Steinfeld
          5 hours ago












          _exactly that _
          – glls
          5 hours ago




          _exactly that _
          – glls
          5 hours ago

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f234419%2fupdate-design-attribute-value-dynamically%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          Long meetings (6-7 hours a day): Being “babysat” by supervisor

          Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

          Confectionery