Home › Forums › vLooup for SharePoint › vlookup search feature
Tagged: vlookup
- This topic has 7 replies, 2 voices, and was last updated 4 years, 6 months ago by
Alexander Bautz.
-
AuthorPosts
-
-
February 24, 2020 at 23:13 #28839
Alex, do we have any search option for the vLookup table? for example like jquery datatable.
-
February 25, 2020 at 16:27 #28863
You can use the datatable plugin, but you must use the vLookupIsLoadedCallback function and call the code when your field has loaded: https://spjsblog.com/vlookup-for-sharepoint/vlookup-user-manual/#vLookupIsLoadedCallback
Add this to the “Load these CSS files” over your Custom CSS:
//cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css
And this to the “Load these files” over your Custom JS:
//cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js
And this to your Custom JS:
function vLookupIsLoadedCallback(fin){ if(fin === "vLookupTasks"){ jQuery("#dffs_vLookupTasks .vLookupTable").not(".dataTables").DataTable(); } }
This example uses a field named vLookupTasks – change it to match your field.
Alexander
-
February 25, 2020 at 17:49 #28869
Okay thank you I will try this, and Alex if I want to check if the vLookup contains some folders, I tried the dataObj[] but its counting only the documents and not the folders. How can I check how many folders and items I have in the vLookup?
-
February 25, 2020 at 19:40 #28871
I haven’t though of that, but if it is root folders you can use something like this:
function vLookupIsLoadedCallback(fin){ if(fin === "vLookupDocuments"){ var folderCount = jQuery("#dffs_vLookupDocuments .vLookupFolderTable").length; alert(folderCount); } }
Replace vLookupDocuments with your field internal name.
Alexander
-
February 25, 2020 at 20:44 #28874
Hi alex, the vlookup datatable worked fine but for vlookup documents when you click the manual refresh the vlookup disappear.
-
February 25, 2020 at 22:36 #28878
Not sure I follow – can you give me some more details?
Alexander
-
February 26, 2020 at 08:54 #28887
for vLookupItems, the jquery datatable works fine but for the vLookupDocuments if you upload new document and the vLookup is refreshed the data will disappear and in the console we have an error “_DT_CellIndex” jqeury.datatable.min
-
February 26, 2020 at 09:51 #28891
If you use folders or group the vLookup table it might not work – and please note that I don’t have an “official” support for using datatables for the vLookup table so it it does not work I’m afraid I cannot promise any fix for it.
If you only need the search feature, I wrote a snippet about a year ago: https://spjsblog.com/forums/topic/vlookup-search/
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.