jQuery UI Widgets › Forums › Editors › CheckBox, RadioButton › Checkbox not working after update to 2.6
Tagged: checkboxes
This topic contains 2 replies, has 2 voices, and was last updated by dujmovicv 12 years ago.
Viewing 3 posts - 1 through 3 (of 3 total)
-
Author
-
Hi All,
I’ve upgraded the JQGrid from 2.4 to 2.6 and now my script doesn’t work… The only editable field is the checkbox which can be ‘true’ or ‘false’. I assume I made some mistakes during the upgrade. Could you please look at my code and tell me what’s wrong?
$(document).ready(function () { // prepare the data var data = {}; var theme = 'classic'; var source = { datatype: "json", datafields: [ { name: 'id', type: 'number' }, { name: 'task_name', type: 'string' }, { name: 'task_description', type: 'string' }, { name: 'task_cost_total', type: 'string' }, { name: 'link_to_pr_task', type: 'string' }, { name: 'planned_finish', type: 'string' }, { name: 'finished', type: 'number' }, { name: 'added_by', type: 'string' } ], id: 'id', url: '../grid/jqwidgets/controllers/tasks_on_pr_controller.php?action=<?=$action;?>', deleterow: function (rowid, commit) { // synchronize with the server - send delete command var data = "delete=true&id=" + rowid; $.ajax({ dataType: 'json', url: '../grid/jqwidgets/controllers/tasks_on_pr_controller.php?action=<?=$action;?>', data: data, success: function (data, status, xhr) { // delete command is executed. commit(true); } }); }, updaterow: function (rowid, rowdata, commit) { // synchronize with the server - send update command var data = "update=true&" + $.param(rowdata); $.ajax({ dataType: 'json', url: '../grid/jqwidgets/controllers/tasks_on_pr_controller.php?action=<?=$action;?>', data: data, success: function (data, status, xhr) { // update command is executed. commit(true); } }); } }; // filter var addfilter = function () { var filtergroup = new $.jqx.filter(); var filter_or_operator = 1; var filtervalue = ''; var filtercondition = 'contains'; var filter1 = filtergroup.createfilter('stringfilter', filtervalue, filtercondition); filtervalue = ''; filtercondition = 'starts_with'; var filter2 = filtergroup.createfilter('stringfilter', filtervalue, filtercondition); filtergroup.addfilter(filter_or_operator, filter1); filtergroup.addfilter(filter_or_operator, filter2); // add the filters. $("#jqxgrid").jqxGrid('addfilter', 'firstname', filtergroup); // apply the filters. $("#jqxgrid").jqxGrid('applyfilters'); } var dataAdapter = new $.jqx.dataAdapter(source); var editrow = -1; // initialize jqxGrid $("#jqxgrid_pr_task").jqxGrid( { source: dataAdapter, width: "100%", // css/tabcontent.css LINE 164 <? if ($permisssionToSetTaskFinishedReopen == 1) { echo "editable: true,"; } ?> theme: theme, pageable: true, autoheight: true, columnsresize: true, sortable: true, filterable: true, autoshowfiltericon: true, columns: [ { text: 'Task Name', datafield: 'link_to_pr_task', editable: false }, { text: 'Task Description', datafield: 'task_description', editable: false }, { text: 'Task Cost', datafield: 'task_cost_total', editable: false }, { text: 'Planned finish', datafield: 'planned_finish', editable: false }, { text: 'Finished', datafield: 'finished', columntype: 'checkbox' }, { text: 'Added by', datafield: 'added_by', editable: false } ] }); $("#deleterowbutton_task_list").jqxButton({ theme: theme }); // delete row. $("#deleterowbutton_task_list").bind('click', function () { var selectedrowindex = $("#jqxgrid_pr_task").jqxGrid('getselectedrowindex'); var rowscount = $("#jqxgrid_pr_task").jqxGrid('getdatainformation').rowscount; if (selectedrowindex >= 0 && selectedrowindex < rowscount) { var id = $("#jqxgrid_pr_task").jqxGrid('getrowid', selectedrowindex); var commit = $("#jqxgrid_pr_task").jqxGrid('deleterow', id); } }); // trigger the column resized event. $("#jqxgrid_pr_task").bind('columnresized', function (event) { var column = event.args.columntext; var newwidth = event.args.newwidth var oldwidth = event.args.oldwidth; $("#eventlog").html("Column: " + column + ", " + "New Width: " + newwidth + ", Old Width: " + oldwidth); }); });
Thank you in advance.
Hi dujmovicv,
The checkboxes expect a datafield with “type” set to “bool” or “boolean”.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comThat was that Peter, thank you!!!!
-
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.