EasyUI Forum
January 28, 2026, 01:51:12 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
  Home Help Search Login Register  
  Show Posts
Pages: [1]
1  General Category / General Discussion / Re: How to makes Grid Filter on server side? on: March 03, 2014, 11:18:07 PM
Hello to you Stworthy,

Thanks for an example and It's great to makes me more understanding its concept.

Part of an example :
$filterRules = isset($_POST['filterRules']) ? ($_POST['filterRules']) : '';
// $filterRules contains [{\"field\":\"productid\",\"op\":\"contains\",\"value\":\"gg\"},{\"field\":\"attr1\",\"op\":\"contains\",\"value\":\"dd\"}]

Its format is quite strange because in every paramaters included "\" character at the end makes json_decode not works.

So to solve it, I try to clean-up all the "\" character as shown below :

Code:
$filterRules = isset($_POST['filterRules']) ? ($_POST['filterRules']) : '';
$cond = "productid like '%%'";
if (!empty($filterRules)){
$filterRules = str_replace('\\','',$filterRules);
$filterRules =json_decode($filterRules);
foreach($filterRules as $rule){
$rule = get_object_vars($rule);
$field = $rule['field'];
$op = $rule['op'];
$value = $rule['value'];
if (!empty($value)){
if ($op == 'contains'){
$cond .= " and ($field like '%$value%')";
} else if ($op == 'greater'){
$cond .= " and $field>$value";
} else if($op == 'equal'){
$cond .= " and $field='$value'";
}
}
}
}


My questions is, it is the proper way to clean-up all the "\" or buggy?

Please advice and show me by code

Regards,

Steven


2  General Category / General Discussion / Re: How to makes Grid Filter on server side? on: March 03, 2014, 02:44:32 AM
Hello to you Stworthy,

I'm using EasyUI 1.3.5

From Forum I found yr solution of How to passing/get filterbox value?
- Filterbox editor type is TEXT, Let says I have typed character B on the filterbox
var nameEditor = $('#tt').datagrid('getEditor',{index:index,field:'name'});
var nameValue = $(nameEditor.target).val(); // get name field value

My Questions is how to show/display nameValue?
I tried code as :
alert(nameValue);

The result is empty/nothing, the answer is I should get B


Another example is :
-Filterbox editor type is COMBOBOX, Let say I choose AMERICA
var countryEditor = $('#tt').datagrid('getEditor',{index:index,field:'country'});
var countryValue = $(countryEditor.target).combobox('getValue'); // get country field value, notice that the editor type is combobox

How to show/display countryValue?
I tried code as :
alert(countryValue);

The result is AMERICA, but when post this value to crud.php, the crud.php cannot recieved the value

Please advice and show me an example

Thanks & Regards,

Steven
3  General Category / General Discussion / Re: How to makes Grid Filter on server side? on: March 02, 2014, 11:15:10 PM
Hello to you Stworthy,

Thanks for yr prompt reply.

Facing to my cases, Lets says Genderid type as TEXT not COMBOBOX, the code as shown :
var dg = $('#dg').datagrid({remoteFilter:true,type:'post',url:'crud.php'});

The Problems is : crud.php not recieved the typed text in Filter box, lets says I type M into filter box.
I means M not passing into crud.php

Would you mind show me an example for above cases?

Please advice & thanks in advance

Regards,
Steven
4  General Category / General Discussion / How to makes Grid Filter on server side? on: February 28, 2014, 10:53:34 PM
Hello to you,

I'm newbie in learning EasyUI

How to makes Grid Filter on server side?
From the documentation and forum I learned to write as below :

Code:
        <script type="text/javascript" src="datagrid-filter.js"></script>

        <script type="text/javascript">
           $(function(){
            var dg = $('#dg').datagrid({remoteFilter:true,type:'post',url:'crud.php'});
            dg.datagrid('enableFilter', [{
                field:'genderid',
                type:'combobox',
                options:{
                    panelHeight:'auto',
                    data:[{value:'',text:'All'},{value:'F',text:'F'},{value:'M',text:'M'}],
                    onChange:function(value){
                        if (value == ''){
                            dg.datagrid('removeFilterRule', 'genderid');
                        } else {
                            dg.datagrid('addFilterRule', {
                                field: 'genderid',
                                op: 'equal',
                                value: value
                            });
                        }
                        dg.datagrid('doFilter');
                    }
                }
            }]);
        });
    </script>


Genderid contains :
M means Male
F means Female

The problem is :
The genderid not passing its value to server side (crud.php)

My Questions is :
How to passing the filtered genderid to server side?

Please correct me and show me its solution by an example.

Thanks & Regards,

Steven
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!