誰かが私にマイナス 1 を付けたようです。 私は経験のない 55 歳の母親です。私には多くのスキルがありますが、これはその 1 つではありません。私は絶対に絶望的で、ここまでたどり着くのに必死です。あなたが助けられないなら、私はそれを受け入れますが、私に対して否定的にならないでください. 私は今泣いています。いくつかの励ましをいただければ幸いです。データベースのアイテムをリピーターに表示するページがあります。このコードは、データベースから入力されたいくつかのドロップダウン フィルターを使用して項目を検索します。断続的に、一見ランダムに (広範なテストにもかかわらずパターンは出現しません)、コードはランダムなドロップダウン フィルターの設定に失敗しています (1 つまたは複数のドロップダウン フィルターが、データベースから自動設定された設定ではなく、既定の設定を表示します)。ページに繰り返しアクセスするか、ページを繰り返し更新することで、これを発見しました。多くの場合、コードは機能し、3 回または 4 回ごとに、1 つまたは複数のドロップダウン フィルターに、データベースから自動入力された設定ではなく、デフォルト設定が表示されます (次に問題が発生した場合は、同じか別の設定になる可能性があります)。または機能しないフィルターのセット) これがコードです。このページには 3 つのドロップダウン フィルターがありますが、このようないくつかのページがあり、それぞれが異なるデータベースを表示および検索し、各ページに最大 10 個のドロップダウン フィルターがあり、すべてにこの断続的な問題があります... 動作しないフィルターのセットと同じか、異なる可能性があります) これがコードです。このページには 3 つのドロップダウン フィルターがありますが、このようないくつかのページがあり、それぞれが異なるデータベースを表示および検索し、各ページに最大 10 個のドロップダウン フィルターがあり、すべてにこの断続的な問題があります... 動作しないフィルターのセットと同じか、異なる可能性があります) これがコードです。このページには 3 つのドロップダウン フィルターがありますが、このようないくつかのページがあり、それぞれが異なるデータベースを表示および検索し、各ページに最大 10 個のドロップダウン フィルターがあり、すべてにこの断続的な問題があります...
import wixData from "wix-data";
$w.onReady(function () {
$w('#iTitle')
$w('#iCounty')
$w('#iGeog')
$w('#dataset1')
$w('#text102')
});
let lastFilterTitle;
let lastFilterCounty;
let lastFilterGeog;
export function iTitle_change(event, $w) {
filter($w('#iTitle').value, lastFilterCounty, lastFilterGeog);
}
export function iCounty_change(event, $w) {
filter(lastFilterTitle, $w('#iCounty').value, lastFilterGeog);
}
export function iGeog_change(event, $w) {
filter(lastFilterTitle, lastFilterCounty, $w('#iGeog').value);
}
function filter(title, county, geog) {
if (lastFilterTitle !== title || lastFilterCounty !== county || lastFilterGeog !== geog) {
let newFilter = wixData.filter();
if (title)
newFilter = newFilter.eq('title', title);
if (county)
newFilter = newFilter.eq('county', county);
if (geog)
newFilter = newFilter.eq('geog', geog);
$w('#dataset1').setFilter(newFilter)
.then(() => {
if ($w('#dataset1').getTotalCount() ===0) {
$w('#text102').show();
}
else {
$w('#text102').hide();
}
})
.catch((err) => {
console.log(err);
});
lastFilterTitle = title;
lastFilterCounty = county;
lastFilterGeog = geog;
}
}
// Run a query that returns all the items in the collection
wixData.query("Psychologists")
// Get the max possible results from the query
.limit(1000)
.ascending("title")
.distinct("title")
.then(results => {
let distinctList = buildOptions(results.items);
// unshift() is like push(), but it prepends an item at the beginning of an array
distinctList.unshift({ "value": '', "label": 'All Psychologists'});
//Call the function that builds the options list from the unique titles
$w("#iTitle").options = distinctList
});
function buildOptions(items) {
return items.map(curr => {
//Use the map method to build the options list in the format {label:uniqueTitle, valueuniqueTitle}
return { label: curr, value: curr };
})
}
// Run a query that returns all the items in the collection
wixData.query("Psychologists")
// Get the max possible results from the query
.limit(1000)
.ascending("county")
.distinct("county")
.then(results => {
let distinctList = buildOptions(results.items);
// unshift() is like push(), but it prepends an item at the beginning of an array
distinctList.unshift({ "value": '', "label": 'All Counties'});
//Call the function that builds the options list from the unique titles
$w("#iCounty").options = distinctList
});
function buildOptions1(items) {
return items.map(curr => {
//Use the map method to build the options list in the format {label:uniqueTitle1, valueuniqueTitle1}
return { label: curr, value: curr };
})
}
// Run a query that returns all the items in the collection
wixData.query("Psychologists")
// Get the max possible results from the query
.limit(1000)
.ascending("geog")
.distinct("geog")
.then(results => {
let distinctList = buildOptions(results.items);
// unshift() is like push(), but it prepends an item at the beginning of an array
distinctList.unshift({ "value": '', "label": 'All Regions'});
//Call the function that builds the options list from the unique titles
$w("#iGeog").options = distinctList
});
function buildOptions2(items) {
return items.map(curr => {
//Use the map method to build the options list in the format {label:uniqueTitle2, valueuniqueTitle2}
return { label: curr, value: curr };
})
}
export function button45_click(event, $w) {
//Add your code for this event here:
filter($w('#iTitle').value='', $w('#iCounty').value='', $w('#iGeog').value='');
}
私の経験と知識は非常に限られているため、答えは非常に簡単かもしれません。解決策が見つからない場合はプロジェクトを放棄する必要があるため、どんな助けも大歓迎です.ありがとう