Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery ui _Jquery Ui - Fatal编程技术网

Jquery ui

Jquery ui ,jquery-ui,Jquery Ui,以下是我最后不得不做的事情: $(document).ready(function(){ if ($('[attr="searchResultsJson"]').length) { $('.approval-outer-wrap').prepend(drawTable()); $('.approval-outer-wrap').append('<div id="result-details" title="Search Result Detail"><

以下是我最后不得不做的事情:

$(document).ready(function(){
  if ($('[attr="searchResultsJson"]').length)
  {
    $('.approval-outer-wrap').prepend(drawTable());  
    $('.approval-outer-wrap').append('<div id="result-details" title="Search Result Detail"><p></p></div>')
  }

  $('body').on('click', '[id^=openPFDialog]', function() {
      var result = $(this).parents('tr').data('result');
      $('#result-details p').html(result.patientFirstName);
      $('#result-details').dialog();
  });


});

function drawTable(){
    var table = $('<table id="search-results" />');

    var header = $('<thead />');
    table.append(header);

    header.append('<tr><th>Patient File</th><th>First Name</th><th>Last Name</th><th>Date of Birth</th><th>Data Pulse ID</th><th>Laserfiche ID</th></tr>');

    var body = $('<tbody />');
    table.append(body);

    var json = $('[attr="searchResultsJson"] [type="text"]').text();

    var searchResults = JSON.parse(json);

    for (var i = 0; i < searchResults.length; i++) {    

        body.append(`<tr data-result='${JSON.stringify(searchResults[i])}'>`+
            `<td><button id="openPFDialog-` + i + `">&#128269;</button></td>` +
            `<td>${searchResults[i].patientFirstName}</td>` +
            `<td>${searchResults[i].patientLastName}</td>` +
            `<td>${searchResults[i].patientDateOfBirth}</td>` +
            `<td>${searchResults[i].patientDataPulseID}</td>` +
            `<td>${searchResults[i].patientLaserFicheID}</td>` +
            '</tr>');
    }   

  return table;
}
$(文档).ready(函数(){
if($('[attr=“searchResultsJson”]').length)
{
$('.approval outer wrap').prepend(drawTable());
$('.approval outer wrap')。追加('

')) } $('body')。在('click','id^=openPFDialog]'上,函数(){ var result=$(this.parents('tr')。data('result'); $('#result details p').html(result.patientFirstName); $(“#结果详细信息”).dialog(); }); }); 函数drawTable(){ 变量表=$(''); 变量头=$(''); 表.追加(标题); header.append('Patient FileFirst name last name BirthData Pulse IDLaserfiche ID'); 变量主体=$(''); 表.附件(正文); var json=$('[attr=“searchResultsJson”][type=“text”]')。text(); var searchResults=JSON.parse(JSON); 对于(var i=0;i
看起来您正在尝试迭代
搜索结果
,这是一个。。。某物在这种情况下,您可以通过
searchResults[i]
访问每个元素。除此之外,还不清楚你想做什么。您拥有的选择器(例如,
$(“#patientFileDialog[i]”)
)不太可能工作-您是否拥有多个ID为
patientFileDialog
的HTML元素
${searchResults[i]…}
看起来您将PHP语法与JS混合在一起,请删除
${}
。另外,您将反勾号
`
与纯单引号
'
混合在一起-只需使用单引号即可。谢谢!我越来越接近这个密码了。很抱歉,我错过了你早些时候的评论。我必须更新我的代码和我的报税表的其余部分,如果我能让它全部工作,我会将其标记为答案。
var dialog, i;

// Single click handler for anything that starts with "openPFDialog-".
// Since those elements don't exist on the page yet, we need to instead
// select a parent object, say the body, and filter for clicks on our
// elements starting with our pattern
$('body').on('click', '[id^=openPFDialog]', function() {
    // We need to find the "i"
    i = $(this).attr('id').replace(/openPFDialog-/,'');
    console.log('clicked on id', i);
    $('#patientFileDialog-' + i).dialog();
});

for (var i = 0; i < searchResults.length; i++) {    
    // Create a new div with ID like "patientFileDialog-1", using the current
    // search result
    dialog = $('<div id="patientFileDialog-' + i + '" title="Patient File">' + searchResults[i].patientWebLink + '</div>');

    // Add it to the page.  I've use a div with ID dialogs which is hidden
    $('#dialogs').append(dialog);

    $('table').append('<tr>'+
        '<td><button id="openPFDialog-' + i + '">Click Here</button></td>' +
        '<td>' + searchResults[i].patientFirstName + '</td>' +
        '<td>' + searchResults[i].patientLastName + '</td>' +
        '<td>' + searchResults[i].patientDateOfBirth + '</td>' +
        '<td>' + searchResults[i].patientDataPulseID + '</td>' +
        '<td>' + searchResults[i].patientLaserFicheID + '</td>' +
        '</tr>');
}
// Add some new variables to hold our big strings
var dialog, dialogs, row, rows, i;

// ... your code ...

for (var i = 0; i < searchResults.length; i++) {

    // Create the dialog ...
    dialog = ...

    // Append it to our big string of all dialogs
    dialogs += dialog;

    // Same approach for rows
    row = '<tr>'+ ... all that stuff
    rows += row;
}

// Finished iterating, nothing added to DOM yet.  Do it all at once::
$('#dialogs').append(dialogs);
$('table').append(rows);
function showPatientDialog(cnt){
  $("#patient-file-dialog").html(cnt).dialog("open");
}

var d = $("<div>", {
  id: "patient-file-dialog",
  title: "Patient File"
})
  .appendTo("body")
  .dialog({
    autoOpen: false
  });
$.each(searchResults, function(i, result) {
  var row = $("<tr>").appendTo(body);
  $("<td>").appendTo(row).html($("<button>", {
    id: "open-pdf-dialog-" + i
  }).click(function() {
    showPatientDialog(result.patientWebLink);
  }));
  $("<td>").appendTo(row).html(result.patientFirstName);
  $("<td>").appendTo(row).html(result.patientLastName);
  $("<td>").appendTo(row).html(result.patientDateOfBirth);
  $("<td>").appendTo(row).html(result.patientDataPulseID);
  $("<td>").appendTo(row).html(result.patientLaserFicheID);
});
$(document).ready(function(){
  if ($('[attr="searchResultsJson"]').length)
  {
    $('.approval-outer-wrap').prepend(drawTable());  
    $('.approval-outer-wrap').append('<div id="result-details" title="Search Result Detail"><p></p></div>')
  }

  $('body').on('click', '[id^=openPFDialog]', function() {
      var result = $(this).parents('tr').data('result');
      $('#result-details p').html(result.patientFirstName);
      $('#result-details').dialog();
  });


});

function drawTable(){
    var table = $('<table id="search-results" />');

    var header = $('<thead />');
    table.append(header);

    header.append('<tr><th>Patient File</th><th>First Name</th><th>Last Name</th><th>Date of Birth</th><th>Data Pulse ID</th><th>Laserfiche ID</th></tr>');

    var body = $('<tbody />');
    table.append(body);

    var json = $('[attr="searchResultsJson"] [type="text"]').text();

    var searchResults = JSON.parse(json);

    for (var i = 0; i < searchResults.length; i++) {    

        body.append(`<tr data-result='${JSON.stringify(searchResults[i])}'>`+
            `<td><button id="openPFDialog-` + i + `">&#128269;</button></td>` +
            `<td>${searchResults[i].patientFirstName}</td>` +
            `<td>${searchResults[i].patientLastName}</td>` +
            `<td>${searchResults[i].patientDateOfBirth}</td>` +
            `<td>${searchResults[i].patientDataPulseID}</td>` +
            `<td>${searchResults[i].patientLaserFicheID}</td>` +
            '</tr>');
    }   

  return table;
}