EasyUI Forum

General Category => General Discussion => Topic started by: acreonte82 on October 29, 2013, 06:42:45 AM



Title: Some improvements
Post by: acreonte82 on October 29, 2013, 06:42:45 AM
Hello,
my post is only to know if ,in the new version, the crud will have a search function (for each columns)  like kendoui.com crud..

Thanks in advance!!


Title: Re: Some improvements
Post by: stworthy on October 30, 2013, 01:16:16 AM
A datagrid filter example can be found here http://jsfiddle.net/urhv6/.


Title: Re: Some improvements
Post by: acreonte82 on October 30, 2013, 03:44:28 AM
Ok I know, but I mean a search function with logic operator in column..
Like a dropdown menu, foreach columns, with a multiple type of search function with operator  "And/or/not/between.." and "> < =..."

Attached an example


Title: Re: Some improvements
Post by: mapner on October 30, 2013, 06:16:34 AM
stworthy,

Very good example of filter in a grid.
How to use it with remote searching?

thanks


Title: Re: Some improvements
Post by: finzaiko on November 01, 2013, 10:40:14 PM
Yes, Im waiting remote searching too  ;D

Thanks stworthy,


Title: Re: Some improvements
Post by: acreonte82 on November 02, 2013, 05:36:56 AM
stworthy,
I'm waiting your answer !!! ;D ;D ;D



Title: Re: Some improvements
Post by: stworthy on November 02, 2013, 05:54:04 AM
The feature request for remote filtering has been sent to our develop team. We will release this solution after this develop work is finished.


Title: Re: Some improvements
Post by: stworthy on November 07, 2013, 01:41:45 AM
The datagrid filter extension is available now. It can be downloaded from http://www.jeasyui.com/extension/datagrid_filter.php.


Title: Re: Some improvements
Post by: arma on November 10, 2013, 04:07:46 PM
1. How to make any filter component to be autofit the width with its column header width on load? It only fits if i resize column header manually.
2. How if i want to unfilter a column (no filter component in a certain column) ?


Title: Re: Some improvements
Post by: stworthy on November 10, 2013, 06:34:52 PM
Please download the updated datagrid-filter file from from http://www.jeasyui.com/extension/datagrid_filter.php.
To apply a un-filter component, use 'label' filter as below:
Code:
dg.datagrid('enableFilter', [{
field:'itemid',
type:'label'
}]);
The user can also extend a new filter component. The code below shows how to achieve a 'label' filter.
Code:
$.extend($.fn.datagrid.defaults.filters, {
label: {
init: function(container, options){
return $('<span></span>').appendTo(container);
},
destroy: function(target){
$(target).remove();
},
getValue: function(target){
return $(target).html();
},
setValue: function(target, value){
$(target).html(value);
},
resize: function(target, width){
$(target)._outerWidth(width)._outerHeight(22);
}
}
});


Title: Re: Some improvements
Post by: mapner on November 13, 2013, 05:13:03 AM
Hi,

I'm using a button for make remote search.
How I can make search while typing the text like local search?

thanks

Code:
	<table id="g-tck" title="Tickets" class="easyui-datagrid" style="width:auto;height:auto;" url="<?PHP echo _URL_ ?>tickets/GetPage",
toolbar="#tb1"
pagination="true" fitColumns="true" singleSelect="true">
<thead>
<tr>
<th field="NAME"  sortable="true">Customer</th>
<th field="DATETIME_ADD"  sortable="true">Date/Time</th>   
<th field="TITLE"   sortable="true">Title</th>
<th field="STATE"   sortable="true">State</th>   
</tr>
</thead>
</table>
<div id="tb1" style="padding:5px;height:auto"> 
<div> 
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="doSearch()"></a>
</div>
</div>   

Code:

<script type="text/javascript">

function doSearch(){   

var q_filter = JSON.stringify( $('#g-tck').datagrid('options').filterRules );

$('#g-tck').datagrid('load',{  q_filter: q_filter }); 



$(function(){
var dg = $('#g-tck').datagrid({filterBtnIconCls:'icon-filter'});
dg.datagrid('enableFilter');
dg.datagrid('options').remoteFilter = true;
});

</script>



Title: Re: Some improvements
Post by: stworthy on November 13, 2013, 06:54:47 AM
The remote filtering requires the 'url' property set to retrieve data from remote server. When filtering values changed, the 'filterRules' parameter will be sent to remote server.
Code:
$(function(){
var dg = $('#g-tck').datagrid({
filterBtnIconCls:'icon-filter',
url:...,
remoteFilter:true
});
dg.datagrid('enableFilter');
});


Title: Re: Some improvements
Post by: mapner on November 13, 2013, 02:00:35 PM
stworthy,

great work!

May be you must to include this in the documentation:

"When use remote filtering the 'filterRules' parameter will be sent to remote server in JSON format"

Thanks!


Title: Re: Some improvements
Post by: acreonte82 on November 15, 2013, 03:14:55 AM
Great work!!
thank you for having implemented my idea.
Hope this new feature helped many developers and hope it grow with new features!!


Title: Re: Some improvements
Post by: acreonte82 on February 19, 2014, 09:19:20 AM
stworthy can be a great idea to do a Tutorial/Demo of remote data filtering