Open riazsfclouds opened 7 years ago
you can debug your searchKey components is getting set correctly or not, i suspect this will work "event.target.value" for html events only not for any lightning button etc.
Also add helper to this method and you don't need to queue it again, since it already does it for you, all your doing is modifying wherecaluse for the query, that's what search is doing (similar to init logic)
searchKeyChange: function(component, event, helper) { var searchKey = event.getParam("searchKey"); //note this wherecaluse you need modify it again to match against field you want to set like match against fields and then set it. //sample code to search on name field var whereClause = component.get("v.whereclause"); if (whereClause) { whereClause = whereClause + 'AND NAME LIKE %'+searchKey+'%' } else { whereClause = 'NAME LIKE %'+searchKey+'%' } component.set("v.whereclause", whereClause); helper.queryRows(component, component.get("v.page") || 0, helper.getSortOrder(component, false)); },
Also debug your final soql and how its getting formatted.
Hi Ram , Thanks for the Update and i did some changes and you can see i am getting the component set and query is also passigng the values you can see in the Image
I modified the DataTableV2Controller.js (as suggested by you ) searchKeyChange: function(component, event,helper) { var searchKey = event.getParam("searchKey"); alert('-----yyyyy---'+searchKey); var whereClause = component.get("v.whereclause"); if (whereClause) { whereClause = whereClause + 'AND NAME LIKE %'+searchKey+'%' } else { whereClause = 'NAME LIKE %'+searchKey+'%' } component.set("v.whereclause", whereClause); alert('-----xxxx---'+whereClause); var action = helper.queryRows(component, component.get("v.page") || 0, helper.getSortOrder(component, false)); },
Do i also have to change the SearchBarController.js ({ searchKeyChange: function(component, event, helper) { var myEvent = $A.get("e.c:SearchKeyChange"); myEvent.setParams({"searchKey": event.target.value}); myEvent.fire(); } })
Need you help in twiking this
Thanks for the help
Hi @ramanathansj Did you got any chance to have a look into this
I created one Component Name : SearchBar