<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -321,7 +321,12 @@ function createEl(eltype,options,vl,autowidth, ajaxso) {
 					data : {nd:new Date().getTime()},
 					complete: function(data,status){
 						try {delete options['dataUrl'];delete options['value'];} catch (e){}
-						var a = jQuery(data.responseText).html();
+						var a;
+						if(options.buildSelect != null) {
+							var b = options.buildSelect(data);
+							a = jQuery(b).html();
+						} else 
+							a = jQuery(data.responseText).html();
 						if(a) {
 							jQuery(elem).append(a);
 							options = bindEv(elem,options);</diff>
      <filename>js/grid.common.js</filename>
    </modified>
    <modified>
      <diff>@@ -556,8 +556,9 @@ $.jgrid.extend({
 					saveurl = $t.p.url;
 					$($t).jqGrid(&quot;setGridParam&quot;,{url:$t.p.searchurl});
 				}
-				if($.isFunction(p.beforeSearch)){p.beforeSearch.call($t);}
-				$($t).jqGrid(&quot;setGridParam&quot;,{search:sd}).trigger(&quot;reloadGrid&quot;,[{page:1}]);
+				var bsr = false;
+				if($.isFunction(p.beforeSearch)){bsr = p.beforeSearch.call($t);}
+				if(!bsr) $($t).jqGrid(&quot;setGridParam&quot;,{search:sd}).trigger(&quot;reloadGrid&quot;,[{page:1}]);
 				if(saveurl) {$($t).jqGrid(&quot;setGridParam&quot;,{url:saveurl});}
 				if($.isFunction(p.afterSearch)){p.afterSearch();}
 			};
@@ -607,8 +608,9 @@ $.jgrid.extend({
 					saveurl = $t.p.url;
 					$($t).jqGrid(&quot;setGridParam&quot;,{url:$t.p.searchurl});
 				}
-				if($.isFunction(p.beforeClear)){p.beforeClear.call($t);}
-				$($t).jqGrid(&quot;setGridParam&quot;,{search:sd}).trigger(&quot;reloadGrid&quot;,[{page:1}]);
+				var bcv = false;
+				if($.isFunction(p.beforeClear)){bcv = p.beforeClear.call($t);}
+				if(!bcv) $($t).jqGrid(&quot;setGridParam&quot;,{search:sd}).trigger(&quot;reloadGrid&quot;,[{page:1}]);
 				if(saveurl) {$($t).jqGrid(&quot;setGridParam&quot;,{url:saveurl});}
 				if($.isFunction(p.afterClear)){p.afterClear();}
 			};
@@ -651,7 +653,12 @@ $.jgrid.extend({
 								url: surl,
 								dataType: &quot;html&quot;,
 								complete: function(res,status) {
-									$(self).append(res.responseText);
+									if(soptions.buildSelect != null) {
+										var d = soptions.buildSelect(res);
+										if (d)
+											$(self).append(d);
+									} else 
+										$(self).append(res.responseText);
 									if(soptions.defaultValue) $(&quot;select&quot;,self).val(soptions.defaultValue);
 									$(&quot;select&quot;,self).attr({name:cm.index || cm.name, id: &quot;gs_&quot;+cm.name});
 									if(soptions.attr) {$(&quot;select&quot;,self).attr(soptions.attr);}
@@ -672,7 +679,7 @@ $.jgrid.extend({
 							if(cm.searchoptions &amp;&amp; cm.searchoptions.value)
 								oSv = cm.searchoptions.value;
 							else if(cm.editoptions &amp;&amp; cm.editoptions.value) {
-								var oSv = cm.editoptions.value;
+								oSv = cm.editoptions.value;
 							}
 							if (oSv) {	
 								var elem = document.createElement(&quot;select&quot;);
@@ -688,7 +695,6 @@ $.jgrid.extend({
 									}
 								} else if(typeof oSv === &quot;object&quot; ) {
 									for ( var key in oSv) {
-										i++;
 										ov = document.createElement(&quot;option&quot;);
 										ov.value = key; ov.innerHTML = oSv[key];
 										elem.appendChild(ov);</diff>
      <filename>js/grid.custom.js</filename>
    </modified>
    <modified>
      <diff>@@ -303,10 +303,13 @@ jQuery.fn.searchFilter = function(fields, options) {
                     has_custom_data = true;
                     var dEvents = this.dataEvents;
                     var iEvent = this.dataInit;
+                    var bs = this.buildSelect;
                     jQuery.ajax(jQuery.extend({
                         url : this.dataUrl,
                         complete: function(data) {
-                            var $d = jQuery(&quot;&lt;div /&gt;&quot;).append(data.responseText);
+                            var $d;
+                            if(bs != null) $d =jQuery(&quot;&lt;div /&gt;&quot;).append(bs(data));
+                            else $d = jQuery(&quot;&lt;div /&gt;&quot;).append(data.responseText);
                             $d.find(&quot;select&quot;).addClass(&quot;field&quot; + field_num).hide();
                             jData.append($d.html());
                             if (iEvent) initData(&quot;.field&quot; + i, iEvent);</diff>
      <filename>js/jquery.searchFilter.js</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>89eb9e776b03234efd5b4eca88c284ee0a9b6682</id>
    </parent>
  </parents>
  <author>
    <name>tomovtony</name>
    <email>tony@trirand.com</email>
  </author>
  <url>http://github.com/andrewwatts/jqGrid/commit/2603866ca86cbbfe52daa0566b9bcaa3e578000f</url>
  <id>2603866ca86cbbfe52daa0566b9bcaa3e578000f</id>
  <committed-date>2009-11-03T09:01:01-08:00</committed-date>
  <authored-date>2009-11-03T09:01:01-08:00</authored-date>
  <message>Adding buildSerch function in editoptions and/or serchoptions which is called whitin ajax complete. The purpose is to build own selec in case the server can not return the required content</message>
  <tree>1073b18412fa9c8f464e1c422967ce8b8a1931b8</tree>
  <committer>
    <name>tomovtony</name>
    <email>tony@trirand.com</email>
  </committer>
</commit>
