SAR*_*VAN 16 javascript jquery jqgrid
我用jqgrids来显示静态值.但我有一个场景,我需要在JQGrid列中显示复选框和下拉值.取决于我是选中还是取消选中复选框.有关如何使用Dropdown和Checkboxs构建jqgrids的任何想法或意见?
Jus*_*ier 28
您可以使用checkbox格式化程序将单元格显示为复选框.作为colmodel的一部分:
// A checkbox that is read-only until the user edits the row
{name:'my_checkbox',index:'my_checkbox', editable:true,
edittype:"checkbox", formatter:'checkbox' }
// A checkbox that may be edited at any time
{name:'my_clickable_checkbox',index:'my_clickable_checkbox', sortable:true,
formatter: "checkbox", formatoptions: {disabled : false}, editable: true,
edittype:"checkbox"}
Run Code Online (Sandbox Code Playgroud)
对于下拉列表,您可以将自定义格式函数传递给editrow函数:
jQuery('#mygrid').editRow(id, true, formatEditors);
Run Code Online (Sandbox Code Playgroud)
然后,在这个函数中你需要创建一个SELECT(或你需要的任何下拉列表):
function formatEditors(id) {
// Your drop down code here...
// EG: jQuery("#"+id+"_myDropDownRow","#mygrid").
}
Run Code Online (Sandbox Code Playgroud)
因此,当您编辑行时,数据将显示在下拉列表中.
| 归档时间: |
|
| 查看次数: |
18009 次 |
| 最近记录: |