jQWidgets Forums
Forum Replies Created
-
Author
-
I solved my problem redirecting php file with IdPaciente parameter after i set a value to this:
Original php:
http://localhost/pacientes/carga_paciente.php
Redirected php:http://localhost/pacientes/carga_paciente.php?IdPaciente=2014003310
(e.g.)That way grid returns all values refered to this IdPaciente parameter. Is not the best solution, but now it works as i need.
It seems url from adapter doesnt get refresh after calling updateboundataThanks for the reply, but unfortunately it doesnt work. I created a button:
$("#refresh").on('click', function(){ $('#jqxgridDomicilios').jqxGrid('updatebounddata'); });
but dont matter what IdPaciente value is, grid doesnt show added rows.
August 23, 2014 at 12:13 am in reply to: Getting value from dataAdapter Getting value from dataAdapter #58685Thanks, i got it work as i need. Adapter has 7 fields and it feeds combobox, when i change item i get the fields from adapter. If anyone needs an example let me know and i post here.
August 21, 2014 at 11:57 pm in reply to: Getting value from dataAdapter Getting value from dataAdapter #58654Excuse me, but how did you solved it?
Yes, i use updatebouddata after addrow, update and delete, but im not using virtualmode. I think this is cause url: IdPaciente is empty, but when i set a value grids adapter doesnt know url has changed. Maybe if i created source again when IdPaciente is set, grid must show records vinculated with this IdPaciente, its possible?
url: 'includes/funciones.php?funcion=get_pacientes_domicilios&IdPaciente=' + $('#IdPaciente').val(), addrow: function (rowid, rowdata, position, commit) { var data = 'op=AltaDomicilios&' + $.param(rowdata); $.ajax({ datatype: 'json', type: 'POST', url: 'post.php', data: data, cache: false, success: function (data, status, xhr) { commit(true, data); $('#jqxgridDomicilios').jqxGrid('updatebounddata'); }, error: function (jqXHR, textStatus, errorThrown) { commit(false); } }); }, deleterow: function (rowid, commit) { var data = 'op=BajaDomicilios&' + $.param(rowid); $.ajax({ datatype: 'json', type: 'POST', url: 'post.php', data: data, cache: false, success: function (result) { commit(true); $('#jqxgridDomicilios').jqxGrid('updatebounddata'); }, error: function(result){ commit(false); } }); }, updaterow: function(rowid, newdata, commit){ var data = 'op=ModificacionDomicilios&' + $.param(newdata); $.ajax({ datatype: 'json', type: 'POST', url: 'post.php', data: data, cache: false, success: function (result) { commit(true); $('#jqxgridDomicilios').jqxGrid('updatebounddata'); }, error: function(result){ commit(false); } }); }
August 4, 2014 at 9:16 pm in reply to: Select item with keyboard & mouse Select item with keyboard & mouse #58007Thanks for your reply and your time checking this issue, but i think this should be fixed either jQuery & jQWidgets developers. I also though on that solution, and now im working to adapt it. Thanks again.-
August 4, 2014 at 5:19 am in reply to: Select item with keyboard & mouse Select item with keyboard & mouse #57980Its true, $(‘#Nacionalidades’).jqxComboBox(‘getSelectedItem’).value always return the same value, Id value asi need it. What i need is using serialize function get all components value, i found out that selecting item from combo by mouse click serialize function return:
Nacionalidades=IdNacionalidad (number)
although i use keyup or down to select an item serialize function return:
Nacionalidades=stringThats my problem, i need id value, not string. Am i a little more clear now? Thanks for the reply, hope you can help me.
I have done all that and php form(carga_pacientes.php) loads correctly with jqx components data, but what i want to do is clicking on jqxgrid link and open form and load data for a record on DB passed by param:
$('#jqxgrid').jqxGrid( { . . . columns: [{ text: '', cellsalign: 'center', columntype: 'link', width: 100, cellsrenderer: function (row, column, value) { var rowID = $("#jqxgrid").jqxGrid('getrowid', row); var value = $('#jqxgrid').jqxGrid('getcellvaluebyid', rowID, "IdPaciente"); return '<a href="carga_paciente.php?IdPaciente=' + value + '">CLICKEA</a>';}}]
I need to execute a query with IdPaciente param and fill form & their jqx components with data for this particular Id.
I hope ive been a little more clear about it, as my english isnt the best. Thanks again.-If someone need to calculate it, this is the code im using:
function esBiciesto(anio){ if ((anio % 4 == 0 && anio % 100 != 0) || (anio % 4 == 0 && anio % 100 == 0 && anio % 400 == 0)) { return 1; }else{ return 0; } } function cantidadDiasPorMes(anio, mes) { var arrayDiaMes = [[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]]; return arrayDiaMes[esBiciesto(anio)][mes - 1]; } function calcularEdad(fecha){ //fecha HOY var hoy = new Date(); var mesHoy = hoy.getMonth() + 1; var diaHoy = hoy.getDate(); var anioHoy = hoy.getFullYear(); //fecha SELECCIONADA var mesFecha = fecha.getMonth() + 1; var diaFecha = fecha.getDate(); var anioFecha = fecha.getFullYear(); var anios = anioHoy - anioFecha; var meses = mesHoy - mesFecha;; var dias = diaHoy - diaFecha;; if (dias < 0) { meses--; if ((mesFecha - 1) == 0) { dias += cantidadDiasPorMes(anioFecha, 12); } else { dias += cantidadDiasPorMes(anioFecha, mesFecha - 1); } } if (meses < 0) { meses += 12; anios--; } return anios; }
And:
$("#FechaNacimiento").on('close', function(event){ $("#Edad").val(calcularEdad($("#FechaNacimiento").jqxDateTimeInput('getDate'))); });
Thanks for the help, i got it work. Now im facing another problem.
I have listado.php(jqxgrid listing patients and href with patient ID) and listado.js: http://jsfiddle.net/sqHPL/2/
By clicking on link it opens carga_pacientes.php(form with patient data), carga_pacientes.js(jqx components logic): http://jsfiddle.net/t5J6a/
And funciones.php, as content have functions that return json data for components, like this:function get_pacientes(){ global $conexion; $result = $conexion->query(DB_QUERY_SELECT_PACIENTES); $pacientes = array(); if($result && $result->num_rows >0) { while($row = $result->fetch_assoc()) { $fecha_nacimiento = $row['FechaNacimiento'] != null ? (new DateTime($row['FechaNacimiento']))->format('d/m/Y') : null; $pacientes[] = array( "IdPaciente" => $row['IdPaciente'], "Apellido" => htmlentities($row['Apellido']), "Nombre" => htmlentities($row['Nombre']), "IdTipoDocumento" => htmlentities($row['IdTipoDocumento']), "NroDocumento" => $row['NroDocumento'], "FechaNacimiento" => $fecha_nacimiento ); } } return json_encode($pacientes); }
What i want to do is load data on carga_pacientes.php from DB when i click on href on jqxGrid. I use to do it using pure php before using jQuery, but now that i have to implement it i dont know how to load data on jqxcombobox, jqxdatetimeinput, …
How to do it? Thanks for your time and help.Thanks, accomplish it working with validator too, but I have a doubt as to the events that I can use, for example in http://api.jquery.com/category/events/ i found events using jquery but I have seen that the validator also accepts events as “ValueChanged”. Is there a list of events for use in validator? Thank you.-
-
AuthorPosts