EasyUI Forum
May 08, 2024, 01:47:01 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 / EasyUI for jQuery / Re: QueryParams not working on: March 19, 2018, 07:06:16 PM
Thank you, but if you look at my code, I did take the code from this example, however it is not working...
Does this mean that easyui is not able to handle data from a php function?
If I take the function and the parameters out of the equation everything works fine. It can not be possible that this platform expect us to use one php file for every grid action load, save, create,delete.. etc I do see that all the examples are formulated in this manner. Does this mean, that this is the only way for the programmer to use it?
If this is not the case and this framework is actually usable, please take a look at my code and point out what I'm doing wrong.

Thanks for your help!
2  General Category / EasyUI for jQuery / Re: QueryParams not working on: March 19, 2018, 05:46:51 PM
Anybody??
3  General Category / EasyUI for jQuery / Re: QueryParams not working on: March 17, 2018, 06:15:21 PM
This seems to be an ongoing question with no clear and concise explanation. I'm facing this same problem going on 2 days trying different things and suggestions to no apparent solution.  Huh
All I need to do and apparently the OP as well, is to send a parameter from the datagrid call. I need this parameter in order to have one php file with multiple functions, instead of one php file for every datagrid load, update, delete...etc.
I really want to use easyui and want to implement it in my project, but if I can't get this to work, it is a deal breaker for me and would have to move on to something else.
My datagrid looks like this.
Code:
<table id="tt" title="Articulos" class="easyui-datagrid" style="width:700px;height:300px"
iconCls="icon-search"
toolbar="#toolbar, #tb" pagination="true"
rownumbers="true" fitColumns="true" singleSelect="true"
data-options="method:'post',url:'items.php',queryParams:{action:'items'}">
Have also tried this

Code:
<table id="tt" title="Articulos" class="easyui-datagrid" style="width:700px;height:300px"
url="items.php?action=items'
iconCls="icon-search"
toolbar="#toolbar, #tb" pagination="true"
rownumbers="true" fitColumns="true" singleSelect="true"
data-options="method:'post',url:'items.php',queryParams:{action:'items'}">

And a couple of other permutations.
In my php file items.php I am checking if the action parameter is being passed and check if its value is items, if so, then fire off a function within that php file that returns a json result which should be used to load the data grid.


Code:
<?php

include 
'conn.php'
(isset($_POST["action"]) && !empty($_POST["action"])) { //Checks if action value exists
    
$action $_POST["action"];
    echo 
$action;
switch($action) { //Switch case for value of action
      
case "items"get_all_items(); break;
    }
  }

    function 
get_all_items(){
        
    
$page = isset($_POST['page']) ? intval($_POST['page']) : 1;
$rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10;

$type_id = isset($_POST['type_id']) ? mysql_real_escape_string($_POST['type_id']) : '';
$brand_id = isset($_POST['brand_id']) ? mysql_real_escape_string($_POST['brand_id']) : '';
$color_id = isset($_POST['color_id']) ? mysql_real_escape_string($_POST['color_id']) : '';
$upc = isset($_POST['upc']) ? mysql_real_escape_string($_POST['upc']) : '';
$size_id = isset($_POST['size_id']) ? mysql_real_escape_string($_POST['size_id']) : '';
$gender_id = isset($_POST['gender_id']) ? mysql_real_escape_string($_POST['gender_id']) : '';
$material = isset($_POST['material']) ? mysql_real_escape_string($_POST['material']) : '';

$offset = ($page-1)*$rows;
$result = array();

$rs mysql_query("select count(*) from items");
$row mysql_fetch_row($rs);
$result["total"] = $row[0];
$rs mysql_query("select * from items limit $offset,$rows");

$items = array();
while($row mysql_fetch_object($rs)){
array_push($items$row);
}
$result["rows"] = $items;

echo json_encode($result);
    }
    

?>



I really hope someone can let me know what I'm doing wrong here, because I can't figure out what I'm missing.
Sorry to the OP, didn't want to hijack your post, but seems like we are facing the same issue and didn't want to open a duplicate thread.

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