mercredi 29 novembre 2017

How to add checkbox in datagrid with easyui

IN my project, I choose easyui struction.

And CheckBox Selection on DataGrid is in this project.

The official website of EasyUI demo is using url:'datagrid_data1.json', but my date is from database.

$fileN=array();
$sql="select name from OA where sysNum='TZ201711201223';";
$sel=$conn->query($sql);
$row=$sel->fetchAll(PDO::FETCH_ASSOC);

for($i=0;$i<$rowNum;$i++)
{
    $fileN[$i]=$row[$i]['name'];
}

I want to set these value of array fileN to My DataGrid:

echo '<tr>
      <td style="width:10%" colspan="2">attachment</td>
      <td style="width:90%" colspan="18">
         <table  class="easyui-datagrid" title="" style="width:100%" data-options="rownumbers:true,singleSelect:true">
           <thead>
             <tr>
              <th data-options="field:\'ck\',width:5%,checkbox:true"></th>
              <th data-options="field:\'status\',width:85%,align:\'center\'">filename</th>
             </tr>
          </thead>';
     if($rowNum)
     {
       for($i=0;$i<$rowNum;$i++)
       {    
        echo '<tr>   
        <td style="width:5%" colspan="1"><input type="checkbox" >1</td>
        <td style="width:85%" colspan="17"><input style="width:99%"  value="'.$fileN[$i].'"></td>
        </tr>';
       }
     }
       echo '</table>';
      echo '</td>';
    echo  '</tr>';

The value of $rowNum is tag to sign whether have data or not.

$sql="select name from OA where sysNum='TZ201711201223';";
$sel=$conn->query($sql);
$row=$sel->fetch(PDO::FETCH_NUM);
$rowNum=$row[0];

I found it worked fail. I hava no idea about checkbox selection in table.Who can help me?




Aucun commentaire:

Enregistrer un commentaire