JSFiddle - React, Tailwind, and code Playground
by tom pasto
JavaScript
$(document).ready(function () {
var Patient =
{
datatype: "json",
datafields: [
{ name: 'HOSPITAL_NO', type: 'string'},
{ name: 'Patient', type: 'string'}
],
url: '/myurl.php?query=showpatient'
};
$("#Hospitalno").jqxInput({source: function (queries, response) {
var dataAdapter3 = new $.jqx.dataAdapter
(Patient,
{
autoBind: true,
formatData: function (data) {
data.queries = queries;
return data;
},
loadComplete: function (data) {
if (data.length > 0) {
response($.map(data, function (item) {
return item.Patient;
}));
}
}
}
);
},
placeHolder: "Entrer un nom ou num de dossier",displayMember:'Patient', valueMember:'HOSPITAL_NO', height: 25, width: 250, minLength: 1, items: 15,
renderer: function (itemValue, inputValue) {
var value = itemValue.split("-");
return value[0];
}
});
$("#Hospitalno").on('select', function (event) {
if (event.args) {
var item = event.args.item;
if (item) {
var value = item.label.split("-");
$('#Nom').html('<B><SPAN style="font-familly:Arial; font-size:15px; color:#F13338;">'+value[1]+'</SPAN></B>');
$('#SetHospitalNo').val(value[0]);
var data='query=FilterArchive&Hospital_NO='+value[0] ;
$.ajax({
dataType: 'json',
url: '/SaludWeb/data/query.php',
data: data,
success: function (data, status, xhr) {
if (data!=null){
$('#SetArchive').val('1');
$("#Archive").html('<B><SPAN style="font-familly:Arial; font-size:15px; color:#F13338;"> DOSSIER ARCHIVÉ MODIFICATION IMPOSSIBLE </SPAN>');
ShowGrid();
...