jQuery UI Widgets › Forums › Grid › Set id for checkbox in grid
Tagged: checkbox, jqxgrid, selectionmode
This topic contains 1 reply, has 2 voices, and was last updated by Peter Stoev 11 years, 1 month ago.
-
Author
-
Hi
i have question about how can i set the id for checkbox (selectionmode: ‘checkbox’) in grid?
Currently when i Inspect Element at that checkbox , i can see the id=”jqxWidgetb516ecde”
So what i want is.. id=”1″ , can we do that?Sample code :
<!DOCTYPE html>
<html lang=”en”>
<head>
<title id=’Description’>This example illustrates Rows Selection with a Checkbox.
</title>
<link rel=”stylesheet” href=”../../jqwidgets/styles/jqx.base.css” type=”text/css” />
<script type=”text/javascript” src=”../../scripts/jquery-1.10.2.min.js”></script>
<script type=”text/javascript” src=”../../jqwidgets/jqxcore.js”></script>
<script type=”text/javascript” src=”../../jqwidgets/jqxdata.js”></script>
<script type=”text/javascript” src=”../../jqwidgets/jqxbuttons.js”></script>
<script type=”text/javascript” src=”../../jqwidgets/jqxscrollbar.js”></script>
<script type=”text/javascript” src=”../../jqwidgets/jqxmenu.js”></script>
<script type=”text/javascript” src=”../../jqwidgets/jqxgrid.js”></script>
<script type=”text/javascript” src=”../../jqwidgets/jqxgrid.sort.js”></script>
<script type=”text/javascript” src=”../../jqwidgets/jqxgrid.filter.js”></script>
<script type=”text/javascript” src=”../../jqwidgets/jqxgrid.pager.js”></script>
<script type=”text/javascript” src=”../../jqwidgets/jqxgrid.edit.js”></script>
<script type=”text/javascript” src=”../../jqwidgets/jqxgrid.selection.js”></script>
<script type=”text/javascript” src=”../../jqwidgets/jqxpanel.js”></script>
<script type=”text/javascript” src=”../../jqwidgets/jqxcheckbox.js”></script>
<script type=”text/javascript” src=”../../jqwidgets/jqxlistbox.js”></script>
<script type=”text/javascript” src=”../../jqwidgets/jqxdropdownlist.js”></script>
<script type=”text/javascript” src=”../../scripts/demos.js”></script>
<script type=”text/javascript”>
$(document).ready(function () {
var source =
{
datatype: “json”,
datafields: [
{ name: “Samples”, type: ‘string’ },
{ name: “ICD9_Code”, type: ‘string’ },
{ name: “text”, type: ‘string’ },
{ name: “Score”, type: ‘string’ }
],
id: “ID”,
localdata: [{ “ID”: “1”, “Samples”: “Yes”, “ICD9_Code”: “1420”, “text”: “<b>Short Description:</b><br/> Malig neo parotid<br/><b>Description:</b><br/> Malignant neoplasm of parotid gland Hollings: (1741)”, “Score”: “1.355216” }, { “ID”: “2”, “Samples”: “Yes”, “ICD9_Code”: “1421”, “text”: “<b>Short Description:</b><br/> Malig neo submandibular<br/><b>Description:</b><br/> Malignant neoplasm of submandibular gland Hollings: (118)”, “Score”: “1.355216” }]
};
var theme = “”;
var dataAdapter = new $.jqx.dataAdapter(source);$(“#CodeGrid1”).jqxGrid(
{
width: “100%”,autoheight: true,
autorowheight: true,
source: dataAdapter,
pageable: true,
pagesize: 5,
enablebrowserselection: true,
editable: true,
selectionmode: ‘checkbox’,
sortable: true,
filterable: true,
columns: [
{ datafield: “ICD9_Code”, text: “ICD-9 Code”, width: 100, editable: false },
{ datafield: “Samples”, text: “Samples”, width: 100, editable: false },
{ datafield: “Score”, text: “Relevance”, width: 75, editable: false },
{ datafield: “text”, text: “Description”, editable: false }]
});
});
</script>
</head>
<body class=’default’>
<div id=’jqxWidget’ style=”font-size: 13px; font-family: Verdana; float: left;”>
<div id=”CodeGrid1″>
</div>
</div>
</body>
</html>so base on example code , i expect the id for checkbox will be same like that ID in the JSON.
Thank you
Hi knight88,
You can use the documented API and should not try to set ID or something else to HTML Elements which are built by the Grid widget.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.