Show Posts
|
Pages: [1]
|
1
|
General Category / EasyUI for jQuery / edataGrid onSuccess not firing
|
on: April 10, 2016, 12:17:30 PM
|
hello, im using a normal datagrid with detailview, and when this expands a row it will get a subdatagrid, this subdatagrid is where the edatagrid is used, i need to be able to edit 1 value from the row, and i am able to do this correctly, but for some reason the on Success event is never triggering. onError is triggering fine though. here is how im creating the edatagrid. $('#ddv2-'+index).edatagrid({ url:'getOrderDetailProvision.php?id='+row.Id, updateUrl: 'update_sim.php', fitColumns:true, singleSelect:true, rownumbers:true, height:'auto', autoSave:true, columns:[[ {field:'Serie',title:'Serie',width:40}, {field:'UniqueId',title:'Unique ID', width:40}, {field:'AVL',title:'AVL ID', width:40}, {field:'sim',title:'Sim', width:40,editor:'textbox'}, {field:'Numero',title:'Numero Telefonico',width:40}, {field:'Producto',title:'Producto',width:40} ]], onError: function(index2,row2){ console.log("onError"); console.log(row2); }, onSave: function(index3,row3){ console.log("onSave"); console.log(row3); }, onSuccess:function(index4,row4){ console.log("onSuccess"); console.log(row4.msg); }, onEdit:function(index5,row5){ console.log("onEdit"); } }); and my updateURL <?php include "includes/db_config.php"; include "ChromePhp.php"; $post = getRealPOST(); ChromePHP::log("Array : ", $post); $id = intval($post['Id']); $Serie = $post['Serie']; $Producto = $post['Producto']; $AVL = $post['AVL']; $UniqueId = $post['UniqueId']; $sim = $post['sim']; $conn = sqlsrv_connect(SV_NAME, $connectionInfo) OR die("Unable to connect to the database"); $sql = "SELECT Id,Numero from Lineas WHERE Sim= $sim"; $params = array(); $options = array( "Scrollable" => SQLSRV_CURSOR_KEYSET ); $result = array(); $res = sqlsrv_query($conn, $sql, $params, $options); if(sqlsrv_num_rows($res) == 0){ echo json_encode(array( 'isError' => true, 'msg' => 'No existe SIM en BD' )); ChromePHP::log("Error no rows"); ChromePHP::log($sql); }else if(sqlsrv_num_rows > 1){ ChromePHP::log("Error no rows"); echo json_encode(array( 'isError' => true, 'msg' => 'Multiples SIM en BD' )); }else{ $row = sqlsrv_fetch_array( $res, SQLSRV_FETCH_ASSOC); $telefono = $row['Numero']; $sql = "UPDATE producto SET Sim_Id=(SELECT Id from Lineas WHERE Sim= $sim) WHERE Id = $id"; $res = sqlsrv_query($conn, $sql, $params, $options); echo json_encode(array( 'isSuccess' => true, 'Id' => $Id, 'Serie' => $Serie, 'UniqueId' => $UniqueId, 'AVL' => $AVL, 'Producto' => $Producto, 'sim' => $sim, 'Numero' => $telefono )); ChromePHP::log($sql); } function getRealPOST() { $pairs = explode("&", file_get_contents("php://input")); $vars = array(); foreach ($pairs as $pair) { $nv = explode("=", $pair); $name = urldecode($nv[0]); $value = urldecode($nv[1]); $vars[$name] = $value; } return $vars; } ?>
|
|
|
2
|
General Category / EasyUI for jQuery / resizing a datagird
|
on: November 04, 2015, 07:22:26 PM
|
hello,
I have a datagird inside a "main" div, this is the main thing on my page, the rest is only a header and footer, I want for this header and footer to be static size, and that the datagird will take the rest of the space. the footer and header together add up 227 pixels, so i am trying to do browserheight - 227 will give me the desired height on datagrid, but i just can't find how to actually change it via the methods or properties.
Thanks!
|
|
|
4
|
General Category / EasyUI for jQuery / (solved)Multiline headers in datagrid
|
on: September 29, 2015, 02:25:19 PM
|
Hello, i have somewhat "long" headers, and i was trying to make them a fixed width so the datagrid looks nicer. the problem is that the headers are loaded dynamically so i cant have them set to a specific width. The header count is dynamic so my goal is to calculate how many headers im having and later on ill divide it into the number of headers. the problem is that for me to be able to do that i need the header to display in , multiline which i can't, ATM i am not having the dynamic headers and having them static and using "br" tags to make it multiline, which won't do the trick for dynamic header since it wont break lines where it has to. i tried .datagrid-header-row .datagrid-cell{ line-height:normal; height:auto; }
but no success, i dont know if it has something to do that i have a 2 row header. Header: <thead> <tr> <th field="estatus" rowspan="2" align="center">Estatus</th> <th field="Numero" rowspan="2" align="center">Orden</th> <th field="FechaRegistro" align="center" rowspan="2" >Fecha</th> <th field="T1" align="center">00:02:00</th> <th field="T2" align="center">00:24:00</th> <th field="T3" align="center">00:04:00</th> <th field="T4" align="center">02:00:00</th> <th field="Cierre" rowspan="2" align="center">Fecha Cierre</th> </tr> <tr> <th field="P1" align="center" width="80px" styler="formatColor">Informacion tecnica para aprobacion</th> <th field="P2" align="center" width="80px" styler="formatColor">Aprobacion de Informacion Tecnica cliente</th> <th field="P3" align="center" width="80px" styler="formatColor">Informacion Tecnica de Proceso</th> <th field="P4" align="center" width="80px" styler="formatColor">Compra y Recepcion de Materiales</th> </tr> </thead>
Any sugestions?
|
|
|
5
|
General Category / EasyUI for jQuery / Re: datagrid formatter columns
|
on: September 28, 2015, 06:14:40 PM
|
I have been playing around a bit with this to find out that i actually needed a styler instead of formatter, and i managed to make this work out the desired function. in a jsfiddle http://jsfiddle.net/jg0t94g7/56/function formatColor(val,row,lol){ var col = ""; for(var name in row){ col = ""; var value = row[name]; if(value === val){ col = name; } if(col !=="" && val!==""){ var opts = $('#dg').datagrid('getColumnOption',col); var pr =opts["field"].substring(1); var opts2 = $('#dg').datagrid('getColumnOption', 'T'+pr); var time = opts2["title"]; if(val >= time){ return 'background-color:#ff0000;color:white;'; } else{ return 'background-color:#00ff00;color:white;'; } } } return val;
} This works like a charm, the only problem is that headers are not being loaded dynamically here, i cant make it work with dynamic headers. this is how i load my header. function RefreshHeaders(){ $.ajax({ url:"includes/getHeader.php", cache: false, timeout: 5000, async: true, success: function(data){ //console.log(data); var objekJSON=jQuery.parseJSON(data); $('#dg').datagrid({ fit:true, fitColumns:false, columns:objekJSON, url:"includes/Get_Orders.php" }); } }); } and inside my getHeader.php i place the styler like this. include "ChromePhp.php"; $result = array(); $result2 = array(); $stmt = $this->pdo->prepare("SELECT * FROM Procesos"); $stmt->execute(); $rows = $stmt->fetchall(); $nodeParent = array(); $startNode = array(); $startNode['field'] = 'status'; $startNode['title'] = 'Estatus'; $startNode['align'] = 'center'; $startNode['rowspan'] = '2'; array_push($nodeParent,$startNode); $startNode['field'] = 'Numero'; $startNode['title'] = 'Orden'; $startNode['align'] = 'center'; $startNode['rowspan'] = '2'; array_push($nodeParent,$startNode); $startNode['field'] = 'FechaRegistro'; $startNode['title'] = 'Fecha'; $startNode['align'] = 'center'; $startNode['rowspan'] = '2'; array_push($nodeParent,$startNode); foreach($rows as $row){ $node = array(); $node['field'] = 'T' . $row['Id']; $node['title'] = $row['TiempoStd']; $node['align'] = 'center'; array_push($nodeParent,$node); } $proc = array(); foreach($rows as $row){ $node = array(); $node['field'] = 'P' . $row['Id']; $node['title'] = $row['Nombre']; $node['align'] = 'center'; $node['styler']= "formatColor"; array_push($proc,$node); } $startNode['field'] = 'Cierre'; $startNode['title'] = 'Fecha y Hora<br />de Cierre'; $startNode['align'] = 'center'; $startNode['rowspan'] = '2'; array_push($nodeParent,$startNode); array_push($result,$nodeParent); array_push($result2,$proc); $header = array_merge($result,$result2); ChromePhp::log(json_encode($header,JSON_PRETTY_PRINT)); echo json_encode($header);
|
|
|
6
|
General Category / EasyUI for jQuery / datagrid formatter columns
|
on: September 28, 2015, 06:43:14 AM
|
I have a datagrid with easyui, i create dynamically the headers since they depend on my database. i have gotten my header right already. this is the json object being passed to the datagrid. [[ {"field": "status","title": "Estatus","align": "center","rowspan": "2"}, {"field": "Numero","title": "Orden","align": "center","rowspan": "2"}, {"field": "FechaRegistro","title": "Fecha","align": "center","rowspan": "2"}, {"field": "T1","title": "00:02:00","align": "center"}, {"field": "T2","title": "00:24:00","align": "center"}, {"field": "T3","title": "00:04:00","align": "center"}, {"field": "T4","title": "02:00:00","align": "center"}, {"field": "Cierre","title": "Fecha y Hora<br \/>de Cierre","align": "center","rowspan": "2"} ],[ {"field": "P1","title": "Informacion <br\/>tecnica para <br\/>aprobacion","align": "center","formatter": "formatColor()"}, {"field": "P2","title": "Aprobacion de<br\/> Informacion<br\/>Tecnica cliente","align": "center","formatter": "formatColor()"}, {"field": "P3","title": "Informacion<br\/>Tecnica de<br\/>Proceso","align": "center","formatter": "formatColor()"}, {"field": "P4","title": "Compra y<br\/>Recepcion de<br\/>Materiales","align": "center","formatter": "formatColor()"} ]] and i am having a function in my .js function formatColor(val,row){ if (val < 20){ return '<span style="color:red;">('+val+')</span>'; console.log(row); } else { return val; console.log(row); } } but i get this in my console as error. Uncaught TypeError: col.formatter is not a function my grid is being populated with a query every second with some times in the P1,P2,P3,P4 columns, the T1,T2,T3,T4 are just the established time that that column should take. So I am trying to make that if my column value is higher than it it will become red background. But i am trying to at least call the function formatter and i cant even get to that. i got this idea from the API and the this example, the difference is that i am generating the columns dynamically, and my function is not being called so i cant move forward. Thanks,
|
|
|
|