Reputation: 71
I am going to use Appsmith to edit the item price using rest API
{{menitems.data.content}}
From the Image, I have been Displaying my Item with the Edit Button in a table that I got from Rest API While Clicking I have been showing Item's details and the price to be changed
I have been Passing the Price from Table to the javascript object which I have been using storevalue to store the price which I will get the price and show in the popup
{{priceCalculation.openModal(currentRow.pricetype,currentRow.price)}}
I have been passing the price from the table to the popup using the above code
openModal:(price) => {storeValue("price",price);}
Then in the Javascript object, I have been using storeValue to save in a local storage
As you can see I have been getting the price from storeValue and adding in the input box's Default Value
{{appsmith.store.pricebefore}}
From the above code I have been adding the price from the store value
When I change the text it rolls back the value from the storeValue
in the price Input onTextChanged
{{(function({storeValue("pricebefore",price_before_discount.text);priceCalculation.price_before_change(price_before_discount.text);})()}}
In the above code I have to change the text in storeValue too but it's way too slow if I edit too fast like double clear and add text way fast then it's taking too much time to reflect by the time it reflects it's rolling back the value in storeValue
I just need an alternative using the process of getting the price from the table and putting in the input and allowing the user to edit that input without interference
Upvotes: 3
Views: 1000
Reputation: 45
let's use the setValue method to set default value for the input. It will not restore the value when the user inputs.
Upvotes: 0