I am using jqxgrid in my application.Here ,I want to have ‘radiobutton’ selection mode for selecting a particular row as we have ‘checkbox’ selection mode.We have ‘singleselect’ selection mode available for selecting one row at a time but I also want to display the radiobutton for every row as we get it for checkbox.So,can anyone please suggest a solution for this.
that is my code:
const source = useMemo(() => new jqx.dataAdapter({
id: 'id',
localdata: dotsStation,
datatype: 'array',
datafields: [
{ name: 'id', type: 'string', map: "id" },
{ name: 'name', type: 'string', map: 'name' },
{ name: 'descrition', type: 'string', map: 'descrition' },
{ name: 'lat', type: 'number', map: "latitude" },
{ name: 'long', type: 'number', map: "long" },
{ name: 'altitude', type: 'number', map: "altitude" },
{ name: 'idDatum', type: 'number', map: "idDatum" },
{ name: 'status', type: 'string', map: "status" },
{ name: 'sync', type: 'bool', map: "sync" },
], }), [dotsStation]);
const columns = useMemo(() => [
{
text: 'Sync/Unsync', width: "10%", menu: false, dataField: 'sync',
columntype: "checkbox", type: "boolean", enabletooltips: false,
},
{ text: 'Long', datafield: 'long', width: "15%", editable: false },
{ text: 'Lat', datafield: 'lat', width: "15%", editable: false },
{ text: 'Altitude (m)', datafield: 'altitude', width: "15%", editable: false },
{ text: 'Name', datafield: 'name', editable: false, width: "15%" },
{ text: 'Descrition', datafield: 'descrition', editable: false, width: "15%" },
{ text: 'Status', datafield: 'status', editable: false, width: "15%" },
], []);
So, you want to have a "radio button"-like selection mode.
The first solution is that you can use the 'checkbox' selection mode to achieve this.
The pros is,
you can even click on any cell to select a row, not just the checkbox.
The cons is,
the 'select all' checkbox on the header row will not work anymore, but I think it should be that way in your circumstance.
The second solution is use the 'cellvaluechanged' event to detect the field value changes, which I think this should be more preferrable based on your code.