在JediTable loadurl中传递GET参数

时间:2013-10-20 17:10:32

标签: javascript php jquery

背景: 我正在为我医院的手术室创建一个php生成的班次调度程序。在X轴上,我正在绘制日期,在OR上。我正在使用Jeditable来编辑每个单元格,从加载数据的选择中生成下拉列表。

Php代码:

$query = $db->query('select sp.id, sp.sigla from lista_specializzandi sp where sp.id not in (select sp.id from lista_specializzandi sp, esigenze e where sp.id = e.specializzando and e.giorno='.$giorno.' and (e.tipologia=2 or e.tipologia=3 or e.tipologia=4 or e.tipologia =5 or e.tipologia=6 or e.tipologia=7))');
$esiSelect = array();
while ($disp = $db->fetch_array($query)) {
    $esiSelect[$disp['id']] = $disp['sigla'];
}

使用Javascript:

<script>
    $(document).ready(function() {
    $(".turnistica").editable('save_turnistica.php', {
      data        : <?php echo json_encode($esiSelect); ?>,
      type        : 'select',
      indicator   : 'Salvo...',
      tooltip   :   'Clicca per modificare',
      placeholder   :   '&nbsp;',
      onblur    :   'submit',
      event     :   'click',
      submitdata : function(value, settings) {
        return {"giorno" : $(this).attr('id_giorno'), "sala" : $(this).parent().attr('id_riga')};
      }
    });
  });  
    </script>

表格:

<section class="fluid" id="flip-scroll">
            <table id="foglioEsigenze" class="table-bordered table-striped table-condensed cf full">
            <col class="col10">
            <?php 
foreach ($cals as $c)
        echo
        '<col class="dw'.$c->isFeriale.$c->isFestivo.'"></col>';
?>
              <thead class="cf verde_trasp bold text-white">
                  <tr>
            <th class="col1">&nbsp;</th>
            <?php 
foreach ($cals as $c)
        echo
        '<th class="dw'.$c->isFeriale.$c->isFestivo.'"><span style="font-size:9px">'.substr($c->giornoNome, 0, 3).'</span> '.$c->d.'</th>';
?>
          </tr>
              </thead>
                <tbody>

          <?php
while ($s = $db->fetch_array($indice)) {
        echo
        '<tr class="Row" data-blocco="'.$s['blocco'].'" id_riga="'.$s['id'].'"><td style="text-align: left;">'.$s['sigla'].'</td>';
        foreach ($cals as $g) {
        echo
        '<td class="turnistica" style="text-align: center;" id_giorno="'.$g->id.'">';
        global $db;
        $sql = 'select sp.sigla from turnistica t, lista_specializzandi sp where t.giorno = '.$g->id.' and t.riga='.$s['id'].' and t.specializzando = sp.id limit 1';
        $query = $db->query($sql);
        $sigla = $db->fetch_array($query);
        echo $sigla['sigla'];
        '</td>';
        '</tr>';            
        }
}
?>
                </tbody>
      </table>
    </section>

......到目前为止一切顺利! 现在我需要创建一个下拉列表,在我将其插入列后自动删除医生。 我认为这个解决方案,但我不知道为什么它不起作用。

1)我将所有加载代码移动到外部php文件:

<?php  

require ('includes/initialise.php');  
global $db;
$giorno     = $_GET['giorno'];


$query = $db->query('select sp.id, sp.sigla from lista_specializzandi sp where sp.id not in (select sp.id from lista_specializzandi sp, esigenze e where sp.id = e.specializzando and e.giorno='.$giorno.' and (e.tipologia=2 or e.tipologia=3 or e.tipologia=4 or e.tipologia =5 or e.tipologia=6 or e.tipologia=7))');
$esiSelect = array();
while ($disp = $db->fetch_array($query)) {
    $esiSelect[$disp['id']] = $disp['sigla'];
}
echo json_encode($esiSelect);

?>

2)我在javascript中通过loadurl调用了它,添加了元素的属性

loadurl        : "disponibili.php?giorno=" + $(this).attr("id_giorno"),

所有问题都来自我传递的Javascript变量。但是我在没有解决问题的情况下搜索了很多。

我该如何解决这个问题?

@dcaswell:我无法将2)中的javascript变量传递给loadurl文件,因此在填充json列表之前无法执行任何操作。我肯定错过了一些东西。任何帮助将非常感激。 感谢

0 个答案:

没有答案