EasyUI Forum
April 29, 2024, 01:06:55 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Two checkboxes in datagrid auto checking together?  (Read 10259 times)
cohoman
Newbie
*
Posts: 8


View Profile Email
« on: September 30, 2013, 08:11:56 PM »

I'm trying to use a datagrid to display a few rows of data with two columns containing a checkbox each. The problem I'm having, is that when I click one of the checkboxes in a row, the 2nd checkbox in that same row gets checked automatically (and vice-versa). Below is an example of what I'm doing. Is there a way to have two independent checkboxes in separate columns of a datagrid on the same row?

Thanks for the help!

cohoman

Code:
<body>

<table id="process-list" title="Video Processing" class="easyui-datagrid" style="width:700px;height:250px"
url="data/datagrid_data.json"
idField="itemid">
<thead>
<tr>
<th field="scan" checkbox="true">Scan</th>
<th field="cut" checkbox="true">Cut</th>
<th field="filename" width="80">Video File</th>
<th field="duration" width="120">Duration</th>
<th field="status" width="80">Status</th>
</tr>
</thead>
</table>

</body>

<script>

  jQuery("#process-list").datagrid({ data:[{filename:'rabid dog.mp4',duration:'45:25'},
                                           {filename:'hazard pay.mp4',duration:'46:25'},
                                           {filename:'granite state.mp4',duration:'47:25'}]});

</script>
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: October 01, 2013, 07:20:27 AM »

There is only one build-in 'checkbox' column in a row. But you can use 'formatter' function to define your own 'checkbox' columns, just like this.
Code:
<script>
function formatCk(value){
return '<input type="checkbox" value="'+value+'">';
}
</script>
<th field="scan" width="60" formatter="formatCk">Scan</th>
<th field="cut" width="60" formatter="formatCk">Cut</th>
Logged
cohoman
Newbie
*
Posts: 8


View Profile Email
« Reply #2 on: October 02, 2013, 09:31:26 PM »

Great. Thanks for the suggestion and help!
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!