1

I was working on a custom list and fortunatedly, got a custom layout using JS Link to work. I now have a search box and my custom list items visible.

While that's cool and all, I was wondering if I could filter the results in the custom list using the search. Not being very procifient in Sharepoint, I thought: "Well, there's the search box and if I were to look for items sent by a specific person, I could use Javascript to write to the search box and then press Enter and tadaa!"

Yeah, not the smartest move, but it would be enough in this case. Unfortunatedly things didn't go as expected; this method of mine did not work. I tried to write into the input field using Javascript (and jQuery, for good measure), sort of like this:

var elemInput = elemContainingSearchInput.find("input");

elemInput.val("Here is my search");

elemInput.trigger(jQuery.Event('keypress', { keycode: 13 }));

Well, the value was written sort of like a placeholder text for whatever reason and keypress did not get triggered, at least not in a sense that it performed the search!

After all this hassle, I looked for how to perform custom list search in JS Link. Too bad JS Link documentation is pretty much non-existant, so I couldn't find anything useful. And now, I would like to ask you, if it is possible to search a custom list using JS Link and how to do that?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.