Hi Everyone,
I have one list i.e Test and having column i.e ProductName .so i am trying to get data based on custom filter search on same List Page It's Self. In this case i have taken one content editor webpart and i am able to get data but if i send same column value then only it is working but i don't want to send full name only based on any alphabet i want to search,in that case it's not working.
for e.g i have Column name called "ProductName" and Value is 'LG' is there if i search with 'LG' it's working but if i search with 'L' it's not working but i need to search based on 'L'
below is my code
This is working but with same value as List Column value
<script type="text/javascript">
function Search() {
alert("hi");
var searchContent = document.getElementById('txtSearch').value ;
if(searchContent!='')
{
var url;
alert(searchContent);
url = "?List={05DADBA2-8593-42C3-AB74-F5E79742CD7E}&View={9B4EF555-99AB-42C0-BC45-02DA90FDA8CA}&FilterField1=ProductName&FilterValue1=" + searchContent+"";
alert(url);
inplview.MyRefreshPage = MyRefreshPageToEx;
inplview.MyRefreshPage(null, url, null);
}
else
{
alert("Something went wrong");
}
}
function MyRefreshPageToEx(lvTableID, url, bForceSubmit) {
// Hardcode reference to list view <table> Id attribute
var tblv = document.getElementById("{05DADBA2-8593-42C3-AB74-F5E79742CD7E}-{9B4EF555-99AB-42C0-BC45-02DA90FDA8CA}");
var clvp = CLVPFromCtx(tblv);
if (clvp != null && clvp.ctx.IsClientRendering) {
clvp.RefreshPaging(url);
clvp.ctx.queryString = url;
if ((typeof clvp.ctx.operationType == "undefined" || clvp.ctx.operationType == SPListOperationType.Default) && Boolean(clvp.ctx.ListData)) {
var fromPage = clvp.ctx.ListData.FirstRow - 1;
var toPage = Number(GetUrlKeyValue("PageFirstRow", false, url));
if (!isNaN(fromPage) && !isNaN(toPage) && fromPage != toPage)
fromPage < toPage ? (clvp.ctx.operationType = SPListOperationType.PagingRight) : (clvp.ctx.operationType = SPListOperationType.PagingLeft);
}
}
else {
SubmitFormPost(url, bForceSubmit);
}
}
</script>
<input type="text" id="txtSearch"/>
<input type="button" value="Submit" onclick="Search();"/>
This is the code which i have changed for based on alphabet but it's not working
/*url = "?List={05DADBA2-8593-42C3-AB74-F5E79742CD7E}&View={9B4EF555-99AB-42C0-BC45-02DA90FDA8CA}&FilterField1=ProductName&FilterValue1=*" + searchContent+"*";*/
Below image is list with Search
If any one is having relevant information please share it.
Thanks & Regards
Shankar