First thing, I’ve tried local storage to store & get variable but it’s not working. I’ve used same code twice but working for one function but not for other.
Second thing, as the local storage was not working I used the functions & call them in a series and solve the problem. But an error still occurs while loading repeater item “amount” while using onchange() from dropdown. I can’t explain this but you should try because behavior is unknown. Sometimes item shows properly but sometimes not.
Similar behavior with displaying the entries using reset filter. Below is the code:
import wixData from 'wix-data';
import wixUsers from 'wix-users';
import wixSearch from 'wix-search';
//import {session} from 'wix-storage';
import { local } from 'wix-storage';
import wixWindow from 'wix-window';
export function dropdown1_change(event) {
local.clear();
debitsum2();
$w("#dataset1").onReady(function () {
$w("#dataset1").refresh();
wixData.query("kisaandiary").eq("_owner", wixUsers.currentUser.id).eq("expenseFor", $w('#dropdown1').value)
.find()
.then((results) => {
var totalvalues = $w("#dataset1").getTotalCount();
$w('#repeater1').forEachItem(($item) => {
var gettingonchange = parseFloat($item("#text19").text);
if ($item("#text20").text === "Debit") {
var valueonchange = parseFloat((-1) * gettingonchange);
$item("#text19").html = "<p style='font-size: 25px; font-style: avenir; text-align: right; color: red;'>" + valueonchange.toLocaleString('en-IN', {
maximumFractionDigits: 2,
style: 'currency',
currency: 'INR'
}); + "</p>";
} else {
var valueonchange = gettingonchange;
// console.log("Else Running")
$item("#text19").html = "<p style='font-size: 25px; font-style: avenir; text-align: right; color: green;'>" + valueonchange.toLocaleString('en-IN', {
maximumFractionDigits: 2,
style: 'currency',
currency: 'INR'
}); + "</p>";
}
})
})
})
// })
}