我是jwidgets的新手我想问一下如何选择table_id jqxDataTable表格单元格中的当前行,非常感谢您的帮助。我的数据表的代码。
function table_data(){
var name = $("#id_name").val();
var url = "http://bodyline###/###/myschedule?name="+name;
// prepare the data
var source =
{
dataType: "json",
dataFields: [
{ name: 'schedule_id', type: 'int' },
{ name: 'status', type: 'string' },
{ name: 'day', type: 'string' },
{ name: 'start_am', type: 'string' },
{ name: 'end_am', type: 'string' },
{ name: 'start_pm', type: 'string' },
{ name: 'end_pm', type: 'string' },
{ name: 'dob', type: 'string' }
],
id: 'id',
url: url
};
var dataAdapter = new $.jqx.dataAdapter(source);
$("#dataTable").jqxDataTable(
{
width: 920,
pageable: true,
pagerButtonsCount: 10,
source: dataAdapter,
columnsResize: true,
columns: [
{ text: 'CONTROL', dataField: 'schedule_id', width: 70 },
{ text: 'STATUS', dataField: 'status', width: 150 },
{ text: 'DAYS', dataField: 'day', width: 180 },
{ text: 'MORNING IN', dataField: 'start_am', width: 120 },
{ text: 'MORNING OUT', dataField: 'end_am', width: 120},
{ text: 'AFTERNOON IN', dataField: 'start_pm', width: 140 },
{ text: 'AFTERNOON OUT', dataField: 'end_pm', width: 140},
{ text: 'DATE', dataField: 'dob', width: 120 }
]
});
}
答案 0 :(得分:2)
此事件是行单击
$('#dataTable').on('rowClick',
function (event)
{
var args = event.args;
var row = args.row;
var index = args.index;
var boundIndex = args.boundIndex;
var key = args.key;
var dataField = args.dataField;
var clickEvent = args.originalEvent;
var value = $("#dataTable").jqxDataTable('getCellValue', index, 'schedule_id');
alert(value);
});
答案 1 :(得分:0)
您可以使用$(this)例如
$("#dataTable").click(function() {
var parentRowCss = $(this).getGridParam("schedule_id");
}