eagleeye
|
|
« on: June 24, 2015, 07:26:23 AM » |
|
Hi partners i have one datagrid with one datetimebox and i need to send min and max options but not fixed, like in my code. My need is send dynamic values on min and max, the values for this are in json format and come from all data for datagrid, and with it values i will pretend restrict date range of my datetimebox Sample of json data for datagrid, fecha_min and fecha_max are my range date permitted on my datetimebox { "total": "5", "rows": [ { "id": "1015", "id_evento": "6", "id_usuario": "8", "rpe": "9M671", "solped": "500530548", "fecha_ini_prog": "19-05-2015 10:00", "fecha_fin_prog": "19-05-2015 12:00", "fecha_ini_real": "23-06-2015 10:00", "fecha_fin_real": "23-06-2015 12:00", "fecha_min": "24-06-2015 13:00", "fecha_max": "31-06-2015 13:00", "fecha_real_rango": "23-06-2015 10:00 | 23-06-2015 12:00", "duracion": "02:00:00", "titulo": "Acto de Apertura SBIE 500530548 LLANTA 11 R-22.5 LPI DIF. 1 18164039-003-15 \"B\"", "descripcion": "SBIE 500530548 LLANTA 11 R-22.5", "padre": "1", "evento": "APERTU", "desc_evento": "Acto de Apertura", "color": "#64FE2E" }, { "id": "1016", "id_evento": "7", "id_usuario": "8", "rpe": "9M671", "solped": "500530548", "fecha_ini_prog": "22-05-2015 13:00", "fecha_fin_prog": "22-05-2015 14:00", "fecha_ini_real": "24-06-2015 13:00", "fecha_fin_real": "24-06-2015 14:00", "fecha_min": "24-06-2015 13:00", "fecha_max": "31-06-2015 13:00", "fecha_real_rango": "23-06-2015 13:00 | 23-06-2015 14:00", "duracion": "01:00:00", "titulo": "Evaluación Técnica SBIE 500530548 LLANTA 11 R-22.5 LPI DIF. 1 18164039-003-15 \"B\"", "descripcion": "SBIE 500530548 LLANTA 11 R-22.5", "padre": "0", "evento": "EVALUAT", "desc_evento": "Evaluación Técnica", "color": "#31B404" }, { "id": "1017", "id_evento": "8", "id_usuario": "8", "rpe": "9M671", "solped": "500530548", "fecha_ini_prog": "22-05-2015 13:00", "fecha_fin_prog": "22-05-2015 14:00", "fecha_ini_real": "24-06-2015 13:00", "fecha_fin_real": "24-06-2015 14:00", "fecha_min": "24-06-2015 13:00", "fecha_max": "31-06-2015 13:00", "fecha_real_rango": "23-06-2015 13:00 | 23-06-2015 14:00", "duracion": "01:00:00", "titulo": "Evaluación Económica SBIE 500530548 LLANTA 11 R-22.5 LPI DIF. 1 18164039-003-15 \"B\"", "descripcion": "SBIE 500530548 LLANTA 11 R-22.5", "padre": "0", "evento": "EVALUAE", "desc_evento": "Evaluación Económica", "color": "#31B404" }, { "id": "1018", "id_evento": "9", "id_usuario": "8", "rpe": "9M671", "solped": "500530548", "fecha_ini_prog": "26-05-2015 13:00", "fecha_fin_prog": "26-05-2015 15:00", "fecha_ini_real": "24-06-2015 13:00", "fecha_fin_real": "24-06-2015 15:00", "fecha_min": "24-06-2015 13:00", "fecha_max": "31-06-2015 13:00", "fecha_real_rango": "23-06-2015 13:00 | 23-06-2015 15:00", "duracion": "02:00:00", "titulo": "Fallo SBIE 500530548 LLANTA 11 R-22.5 LPI DIF. 1 18164039-003-15 \"B\"", "descripcion": "SBIE 500530548 LLANTA 11 R-22.5", "padre": "0", "evento": "FALLO", "desc_evento": "Fallo", "color": "#FFFFFF" }, { "id": "1019", "id_evento": "10", "id_usuario": "8", "rpe": "9M671", "solped": "500530548", "fecha_ini_prog": "02-06-2015 14:00", "fecha_fin_prog": "02-06-2015 15:00", "fecha_ini_real": "24-06-2015 14:00", "fecha_fin_real": "24-06-2015 15:00", "fecha_min": "24-06-2015 13:00", "fecha_max": "31-06-2015 13:00", "fecha_real_rango": "23-06-2015 14:00 | 23-06-2015 15:00", "duracion": "01:00:00", "titulo": "Formalización del Contrato SBIE 500530548 LLANTA 11 R-22.5 LPI DIF. 1 18164039-003-15 \"B\"", "descripcion": "SBIE 500530548 LLANTA 11 R-22.5", "padre": "0", "evento": "FORMAL", "desc_evento": "Formalización del Contrato", "color": "#FFFFFF" } ] }
<th field= "fecha_ini_real" fixed="true" width="115" align="center" editor="{ type:'datetimebox', options:{ min:'21-06-2015', max:'28-06-2015', disabled: false, editable:false, currentText:'Hoy', closeText:'Cerrar', okText:'Aceptar', showSeconds:false, onHidePanel:aumentaHora, onShowPanel:restringeRango } }"> Fecha Inicio </th>
This is mi validator with fixed values function restringeRango() { var row = $('#ejec_tt_eventos').datagrid('getSelected'); //alert( row.fecha_ini_real ); var opts = $(this).datetimebox('options'); $(this).datetimebox('calendar').calendar({ validator: function (date) { var min = opts.parser(opts.min); // fixed value on datetimebox var max = opts.parser(opts.max); //fixed value on datetimebox if (min <= date && date <= max) { return true; } else { return false; } } }); }
|