[英]easyui populate datagrid data based on combobox value
I'm using http://www.jeasyui.com . 我正在使用http://www.jeasyui.com 。
I need to populate datagrid based on values from combobox. 我需要根据组合框中的值填充datagrid。
I populate combobox with, 我用以下方法填充组合框:
<input id="listcombo"class="easyui-combobox" name="lo_client_id" data-options="url:'get_lists.php',valueField:'id',textField:'listName',panelHeight:'auto'">
and it is working fine. 而且工作正常。 Datagrid looks like,
Datagrid看起来像
<table id="dg" title="My Numbers" class="easyui-datagrid" style="width:500px;height:250px"
url="get_users.php
toolbar="#toolbar" pagination="true"
rownumbers="true" fitColumns="true" singleSelect="true">
<thead>
<tr>
<th field="number" width="50">Numbers</th>
</tr>
</thead>
</table>
When I give url = "get_users.php?id=1 gives me required results, but id should be dynamic according to combobox. How can I do that ? 当我给url =“ get_users.php?id = 1时,给我所需的结果,但是id根据组合框应该是动态的。我该怎么做?
you can use the onSelect
event of combobox and get the selected value and pass it to the url 您可以使用组合框的
onSelect
事件并获取所选值并将其传递给url
HTML HTML
<input id="listcombo" name="listcombo">
$('#listcombo').combobox({
url:'get_lists.php',
valueField:'id',
textField:'listName',
panelHeight:'auto',
onSelect:function(record){
$('#dg').datagrid({
url:"get_users.php?id="+record.id
});
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.