EasyUI Forum
May 16, 2024, 07:21:15 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: onSelect event for datagrid [SOLVED]  (Read 10173 times)
svsnead
Newbie
*
Posts: 15


View Profile Email
« on: February 28, 2016, 08:55:24 AM »

I having a problem getting onSelect to work. It does not fire when I select the row. I trying to have it to come up with at yes no to save.

Code:
       <div id="c4" class="c3">
<table id="ci" title="Chapters/Contacts" class="easyui-datagrid" style="width:400px;height:450px"
                     toolbar="#tb" pagination="true" idField="id"
rownumbers="true" fitColumns="true" singleSelect="true">
<thead>
<tr>
<th data-options="field:'name',width:100">Chapter</th>
<th field="type" width="60" >Type</th>
<th field="state" width="70">State</th>
<th field="id" width="70">id</th>
</tr>
</thead>
</table>

This is how I setup the event:

Code:
		$(function(){
                 $('#ci').datagrid({
                    onSelect: function(rowIndex, rowData)
                     {
                       alert("test");
                     }
                 });
                 });

« Last Edit: February 28, 2016, 01:00:27 PM by svsnead » Logged
svsnead
Newbie
*
Posts: 15


View Profile Email
« Reply #1 on: February 28, 2016, 09:51:33 AM »

I added onSelect to the datagrid table and it still did not work:

Code:

<table id="ci" title="Chapters/Contacts" class="easyui-datagrid" style="width:400px;height:450px"
                     toolbar="#tb" pagination="true" idField="id" onSelect: function(rowIndex, rowData){{alert(rowData);}
rownumbers="true" fitColumns="true" singleSelect="true">
Logged
svsnead
Newbie
*
Posts: 15


View Profile Email
« Reply #2 on: February 28, 2016, 12:59:57 PM »

Found that if the form is hidden you can not add a function. So I made sure the onSelect event was init before.
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!