I have function where results are putted to repeater. Few field are numbers and when i write .text i get error
Wix code SDK error: The text parameter that is passed to the text method cannot be set to the value 0. It must be of type string.K moje pokojeLine 64
i can change it as text and it works but i need it as numbers because later i need to do some sorting as number not text . Can i have text and than change as number somehow? or its solved some other way i can not discover?
function pobierzwolnepokoje(){ getEmptyRooms() .then((emptyRoomsList) => { $w("#repeater4").data = emptyRoomsList; $w("#repeater4").forEachItem( ($item, itemData, index) => { $item(`#text84`).text = itemData.title; $item(`#text86`).number = itemData.g2; $item(`#itext832`).number = itemData.sortowanie; $item(`#text87`).text = itemData.dostawkimax; $item(`#text90`).text = itemData.lokalizacja; $item(`#text91`).text = itemData.uwagi; $item(`#text94`).text = itemData._id; $item("#gallery4").items = itemData.zdjeciepo; } ); }) .catch( (err) => { // console.log(err); }); }
The text element is string based you anything you assign to a text element must be of type string. But you can convert any number to a string object using the below sample code. Good luck.
$item(`#itext832`).number = itemData.sortowanie.toString();
If this is the help you need and my answer was good, please mark it as top comment as it will help others to find the solution.