Datasheet - Sort

When editing collections, either in the editor (sandbox data) or in My Account (live data), filtering/sorting is done for display purposes and does not affect the live site.
Imagine that you want to go over your live data just to check something (for example, number of orders of the same product) and you filter it - that must not affect your live site.

Regarding your error, there are 2 issues there:

  1. When selecting an element with $w, you need to put the “#” sign and then the element ID as it appears in the properties panel. So, instead of selecting the dataset you want to sort by $w(“PLAYERS_NAME_IMPORT”), you need to select like this: $w(“#dataset5”)
  2. When working with $w and elements, you need to wait for the page to be ready, just like in regular web development, meaning you need to put any code that interacts with elements inside a “onReady” callback.

The final code should look like this (use this instead of the sort code you added at the end of the file):

$w.onReady(() => {
	$w("#dataset5").setSort( wixData.sort()
	  .ascending("record")
	);
});

One issue that is on our side is the non-informative error you got. We will fix it in a future release.

Let me know if you need any further help.