EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: svsnead on February 28, 2016, 08:55:24 AM



Title: onSelect event for datagrid [SOLVED]
Post by: svsnead 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");
                     }
                 });
                 });



Title: Re: onSelect event for datagrid
Post by: svsnead 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">


Title: Re: onSelect event for datagrid [SOLVED]
Post by: svsnead 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.