Filtering with Javascript

78 views
Skip to first unread message

Miguel MM

unread,
Dec 30, 2017, 6:24:18 AM12/30/17
to mementodatabase
Hello
I am  newby on Javascript. Id like to know if  it  is possible to use a Javascript field from a radio buttons selector to automatically filter entries in a library. Obviously I use filters manually, but I share the library with a team and I need to keep hidden some entries.

I appreciate any help on this topic. Thanks in advance.
Miguel

Bill Crews

unread,
Dec 30, 2017, 7:17:07 AM12/30/17
to Miguel MM, mementodatabase
There is no way I know of to make the unfiltered list of all library entries be reduced in number, whether using JavaScript or otherwise.

Now, JavaScript can be used to assist in filtering, but your example can be done with simple filtering.

An example of what can be done in a JavaScript field to assist in filtering is to apply some logic to the values of fields in the entry to arrive at a value that can then be filtered upon.

Given your motive for this, I suggest using a Library Action to extract a subset of the entries in the current library to another library that can be used by the others.

If you use filter tabs but did not check All as a tab, then all tab-based filters can be set to exclude the entries you want hidden. The problem is that the initial list will still be displayed unfiltered. Once any tab is pressed, you can ensure they are all filtered out, but I don't know how to get the initial unfiltered list of entries to exclude those entries.

The only other feature I know of that might be of use to you is the deleted property of an Entry object (see wiki page Memento JavaScript Library, section Object Entry under Properties). As stated by the developer, it is true if the entry is in the Memento Recycle Bin. What I don't know is if this is just a advisory field or an operative field. It might be nice to pop an entry over into the Recycle Bin and pop it back later by setting e.deleted to true and later back to false, but I don't know if that works. The deleted property may be read-only, so to speak. If it does work, you could use it, probably in an Action of some sort, to hide entries temporarily in the Recycle Bin. Obviously, if you're not careful, you could lose entries that way, also. Of course, while in the bin, you won't see those entries either (except in a search, I think).

Miguel MM

unread,
Dec 30, 2017, 9:32:49 AM12/30/17
to mementodatabase

Thanks for your help and quick answer. I´ll explore your suggestions. 
Regards 
Reply all
Reply to author
Forward
0 new messages