External filters

I would like to disable the filters within the grid (which I know how to do), but then create filters from a free-form set of input boxes somewhere outside of the grid view. Ideally, I would like the user to click a button (“Filter Grid”) before the filtering occurs. What is the best way to accomplish this style filtering?

Have you reviewed:
docs.dhtmlx.com/doku.php?id=dhtm … t_filterby
?

Yes, when I try it I get the following error and I’m not sure why:
error: ‘_locator’ is null or is not object

If I use makeFilter(“mytextbox”,4); , it does register that textbox and work properly, but it is using the setTimeout function to run the filter once the user stops typing, which I wish to avoid.
So I think the filterBy is what I need to get working.

Do you have the Professional version? I believe the filterBy is only available in pro…

Yes, professional version.

Yes, when I try it I get the following error and I’m not sure why:
error: ‘_locator’ is null or is not object

Can you provide any kind of sample where we can reproduce this issue?

Let me know if this is enough for you, the grid is loaded via XML…

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<html>
<head>
<title>TITLE</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="STYLESHEET" type="text/css" href="includes/dhtmlxgrid/dhtmlxgrid.css">

<script src="includes/dhtmlxgrid/dhtmlxcommon.js"></script>
<script src="includes/dhtmlxgrid/dhtmlxgrid.js"></script>
<script src="includes/dhtmlxgrid/dhtmlxgridcell.js"></script>
<script src="includes/dhtmlxgrid/dhtmlxgrid_nxml.js"></script>
<script src="includes/dhtmlxgrid/dhtmlxgrid_srnd.js"></script>
<script src="includes/dhtmlxgrid/dhtmlxgrid_splt.js"></script>
<script src="includes/dhtmlxgrid/dhtmlxgrid_filter.js"></script>
<script src="includes/dhtmlxgrid/dhtmlxgrid_ssc.js"></script>
<script src="includes/common.js"></script>

<script>

	var mygrid;	// Global DHTML grid object
	var gridURLString = "";
	
	function doInitGrid(){
		mygrid = new dhtmlXGridObject('mygrid_container');
		gridURLString = '<c:url value="/TableDataServlet?rqstType=auditTrail&dataLoadType=dynamic"/>';
	
		// For initial grid load set flag indicating initial load
		mygrid.loadXML(gridURLString + '&initialLoad=true');
		
	}

	function doFilter() {
		try {
			mygrid.filterBy(1,document.getElementById("func").value);
		}
		catch(e) {
			alert('Error: '+ e.message);
		}
	}
		
</script>
</head>

<body onLoad="doInitGrid();" >
	
	<!--  Textbox for filter -->
	<input type="text" name="func" id="func" size="12" maxlength="2">
	
	<!--  Button for filter -->
	<input type="button" name="run" value="FILTER" onclick='doFilter()'/>
	
	<div id="mygrid_container" style="width:770px;height:600px;"></div>

</body>

and here is the XML for you to reference… after looking at it, I think the issue lies somewhere inside the XML. The XML was too large to post, so I ommitted a bunch from the middle:

<?xml version="1.0" encoding="UTF-8"?><rows total_count='17354' pos='0'><head><column id='CREATEDTADSTP' width='120' type='ro' align='left' sort='server' format='' hidden='false' >  <![CDATA[<div title='Event Date and Time'>Date/Time</div> ]]> </column><column id='ADT_TYPE_ID' width='30' type='ro' align='left' sort='server' format='' hidden='false' >  <![CDATA[<div title='Function'>Func</div> ]]> </column><column id='ADT_EVENT' width='40' type='ro' align='left' sort='server' format='' hidden='false' >  <![CDATA[<div title='Action'>Act</div> ]]> </column><column id='ADT_USER_ID' width='50' type='ro' align='left' sort='server' format='' hidden='false' >  <![CDATA[<div title='User who Initiated Action'>User</div> ]]> </column><column id='ADT_DRUG_NUM' width='50' type='ro' align='right' sort='server' format='' hidden='false' >  <![CDATA[<div title='Drug Number'>Drug</div> ]]> </column><column id='ADT_LOAD_ID' width='70' type='ro' align='left' sort='server' format='' hidden='false' >  <![CDATA[<div title='Load Id'>LID</div> ]]> </column><column id='ADT_LICENSE' width='70' type='ro' align='left' sort='server' format='' hidden='false' >  <![CDATA[<div title='License'>ULP</div> ]]> </column><column id='ADT_LOT_NUM' width='80' type='ro' align='left' sort='server' format='' hidden='false' >  <![CDATA[<div title='Lot Number'>LotNum</div> ]]> </column><column id='ADT_EXPIRY_DATE' width='70' type='ro' align='center' sort='server' format='' hidden='false' >  <![CDATA[<div title='Expiry Date'>ExpDate</div> ]]> </column><column id='ADT_NDC' width='80' type='ro' align='left' sort='server' format='' hidden='false' >  <![CDATA[<div title='NDC Number'>NDC</div> ]]> </column><column id='ADT_SIZE' width='50' type='ro' align='right' sort='server' format='' hidden='false' >  <![CDATA[<div title='Size'>Size</div> ]]> </column><column id='ADT_QTY' width='50' type='ro' align='right' sort='server' format='' hidden='false' >  <![CDATA[<div title='Quantity'>Qty</div> ]]> </column><column id='ADT_WHSE_LCTN_OLD' width='70' type='ro' align='left' sort='server' format='' hidden='false' >  <![CDATA[<div title='Original Warehouse Location'>Old WLoc</div> ]]> </column><column id='ADT_WHSE_LCTN_NEW' width='70' type='ro' align='left' sort='server' format='' hidden='false' >  <![CDATA[<div title='Destination Warehouse Location'>New WLoc</div> ]]> </column><column id='ADT_PAC_LCTN' width='70' type='ro' align='left' sort='server' format='' hidden='false' >  <![CDATA[<div title='Dispense Location'>Disp Loc</div> ]]> </column><column id='ADT_KR_ID' width='55' type='ro' align='left' sort='server' format='' hidden='false' >  <![CDATA[<div title='Keyrec'>Keyrec</div> ]]> </column><column id='ADT_KID' width='55' type='ro' align='left' sort='server' format='' hidden='false' >  <![CDATA[<div title='Keyrec Id'>KID</div> ]]> </column><column id='PONUMSFX' width='80' type='ro' align='left' sort='server' format='' hidden='false' >  <![CDATA[<div title='PO Number and Suffix'>PO Num</div> ]]> </column><column id='ADT_BARCODE' width='110' type='ro' align='left' sort='server' format='' hidden='false' >  <![CDATA[<div title='Barcode'>Barcode</div> ]]> </column><column id='ADT_RUN_NUM' width='55' type='ro' align='left' sort='server' format='' hidden='false' >  <![CDATA[<div title='Run Number'>Run</div> ]]> </column><column id='ADT_COMMENTS_TXT' width='1500' type='ro' align='left' sort='server' format='' hidden='false' >  <![CDATA[<div title='Optional Notes for Addtional Information'>Comments</div> ]]> </column><beforeInit><call command='setImagePath'><param>includes/dhtmlxgrid/imgs/</param></call><call command='setSkin'><param>light</param></call></beforeInit><afterInit><call command='attachEvent'><param>onKeyPress</param><param>GlobalCopyGridCell</param></call><call command='attachEvent'><param>onXLE</param><param>GlobalRestoreSavedRow</param></call><call command='attachEvent'><param>onDynXLS</param><param>GlobalAllowGridFetch</param></call><call command='enableSmartRendering'><param>true</param></call><call command='enableCollSpan'><param>true</param></call><call command='attachHeader'><param>#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#rspan</param></call><call command='splitAt'><param>3</param></call></afterInit></head><userdata name='maxExportRows'>5000</userdata><row id='0'><userdata name='RowId'> <![CDATA[AAART8AAFAADmwiAA0]]> </userdata><cell> <![CDATA[<a onclick=loadWindow('auditDetails.action?adtId=7375641')  href=#>03/05/2010 17:28:34</a>]]></cell><cell>US</cell><cell>SON</cell><cell>USR</cell><cell> <![CDATA[<a onclick=loadWindow('inquiry.action?functionName=auditTrail&drugNo=&mode=LAUNCH&rowId=AAART8AAFAADmwiAA0')  href=#></a>]]></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell>USR Logged Into APP.</cell></row><row id='1'><userdata name='RowId'> <![CDATA[AAART8AAFAADmwaAAJ]]> </userdata><cell> <![CDATA[<a onclick=loadWindow('auditDetails.action?adtId=7375640')  href=#>03/05/2010 17:11:09</a>]]></cell><cell>US</cell><cell>SOF</cell><cell>USR</cell><cell> <![CDATA[<a onclick=loadWindow('inquiry.action?functionName=auditTrail&drugNo=&mode=LAUNCH&rowId=AAART8AAFAADmwaAAJ')  href=#></a>]]></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell>USR Logged Out of APP due to session timeout.</cell></row><row id='2'><userdata name='RowId'> <![CDATA[AAART8AAFAADmwcAAs]]> </userdata><cell> <![CDATA[<a onclick=loadWindow('auditDetails.action?adtId=7375639')  href=#>03/05/2010 16:49:07</a>]]></cell><cell>US</cell><cell>SOF</cell><cell>USR</cell><cell> <![CDATA[<a onclick=loadWindow('inquiry.action?functionName=auditTrail&drugNo=&mode=LAUNCH&rowId=AAART8AAFAADmwcAAs')  href=#></a>]]></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell>USR Logged Out of APP.</cell></row><row id='3'><userdata name='RowId'> <![CDATA[AAART8AAFAADmwoABH]]> </userdata><cell> <![CDATA[<a onclick=loadWindow('auditDetails.action?adtId=7375638')  href=#>03/05/2010 16:40:05</a>]]></cell><cell>US</cell><cell>SON</cell><cell>USR</cell><cell> <![CDATA[<a onclick=loadWindow('inquiry.action?functionName=auditTrail&drugNo=&mode=LAUNCH&rowId=AAART8AAFAADmwoABH')  href=#></a>]]></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell>USR Logged Into APP.</cell></row><row id='4'><userdata name='RowId'> <![CDATA[AAART8AAFAADmwaAAI]]> </userdata><cell> <![CDATA[<a onclick=loadWindow('auditDetails.action?adtId=7375637')  href=#>03/05/2010 15:51:55</a>]]></cell><cell>US</cell><cell>SON</cell><cell>USR</cell><cell> <![CDATA[<a onclick=loadWindow('inquiry.action?functionName=auditTrail&drugNo=&mode=LAUNCH&rowId=AAART8AAFAADmwaAAI')  href=#></a>]]></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell>USR Logged Into APP.</cell></row>

… stripped rows…

<row id='95'><userdata name='RowId'> <![CDATA[AAART8AAFAADmwmAAV]]> </userdata><cell> <![CDATA[<a onclick=loadWindow('auditDetails.action?adtId=7375546')  href=#>03/03/2010 15:52:49</a>]]></cell><cell>US</cell><cell>SOF</cell><cell>USR001</cell><cell> <![CDATA[<a onclick=loadWindow('inquiry.action?functionName=auditTrail&drugNo=&mode=LAUNCH&rowId=AAART8AAFAADmwmAAV')  href=#></a>]]></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell>USR001 Logged Out of APP.</cell></row><row id='96'><userdata name='RowId'> <![CDATA[AAART8AAFAADmw0AAP]]> </userdata><cell> <![CDATA[<a onclick=loadWindow('auditDetails.action?adtId=7375545')  href=#>03/03/2010 15:35:43</a>]]></cell><cell>US</cell><cell>SON</cell><cell>USR001</cell><cell> <![CDATA[<a onclick=loadWindow('inquiry.action?functionName=auditTrail&drugNo=&mode=LAUNCH&rowId=AAART8AAFAADmw0AAP')  href=#></a>]]></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell>USR001 Logged Into APP.</cell></row><row id='97'><userdata name='RowId'> <![CDATA[AAART8AAFAADmw7AAE]]> </userdata><cell> <![CDATA[<a onclick=loadWindow('auditDetails.action?adtId=7375544')  href=#>03/03/2010 15:32:21</a>]]></cell><cell>US</cell><cell>SON</cell><cell>USR</cell><cell> <![CDATA[<a onclick=loadWindow('inquiry.action?functionName=auditTrail&drugNo=&mode=LAUNCH&rowId=AAART8AAFAADmw7AAE')  href=#></a>]]></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell>USR Logged Into APP.</cell></row><row id='98'><userdata name='RowId'> <![CDATA[AAART8AAFAADmxDAAD]]> </userdata><cell> <![CDATA[<a onclick=loadWindow('auditDetails.action?adtId=7375543')  href=#>03/03/2010 15:09:49</a>]]></cell><cell>US</cell><cell>SOF</cell><cell>USR</cell><cell> <![CDATA[<a onclick=loadWindow('inquiry.action?functionName=auditTrail&drugNo=&mode=LAUNCH&rowId=AAART8AAFAADmxDAAD')  href=#></a>]]></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell>USR Logged Out of APP due to session timeout.</cell></row><row id='99'><userdata name='RowId'> <![CDATA[AAART8AAFAADmwsAAg]]> </userdata><cell> <![CDATA[<a onclick=loadWindow('auditDetails.action?adtId=7375542')  href=#>03/03/2010 15:07:03</a>]]></cell><cell>US</cell><cell>SOF</cell><cell>USR</cell><cell> <![CDATA[<a onclick=loadWindow('inquiry.action?functionName=auditTrail&drugNo=&mode=LAUNCH&rowId=AAART8AAFAADmwsAAg')  href=#></a>]]></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell>USR Logged Out of APP due to session timeout.</cell></row></rows>

To add to this, it seems if there is a small number of records (i.e. the grid can display them all at once) it works fine. But if there are more records that need to be fetched (as in the example XML posted) it gives me the error mentioned.

It seems you are using dynamic loading? filterBy() method require all rows to be loaded. There is no way to filter grid if some of the rows is not loaded yet to the client side.
In case of dynamic loading you should use server side filtering. Please find more information here dhtmlx.com/docs/products/dht … 50000.html