jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Grid checkbox checked columns
Tagged: angular grid, bootstrap grid, javascript grid, jquery grid, jqwidgets grid, jqxgrid checkbox row state
This topic contains 8 replies, has 2 voices, and was last updated by lsmarco2008@gmail.com 8 years, 7 months ago.
-
Author
-
Hello,
I believe this topic has already been discussed, but have not found an appropriate response to that need.
In a grid over a need checkbox column to obtain only the checked columns per line.You can check if a checkbox clolumn in a row is checked with
getcellvalue
by passing the datafield of the column as an input parameter, or you can use thegetrowdata
method to get to the value of the cell in a given row. Here are some demos:1) getcellvalue:
http://jsfiddle.net/jqwidgets/pyE55/2)getrowdata:
http://jsfiddle.net/jqwidgets/7pdyg/Best Regards,
ChristopherjQWidgets Team
http://www.jqwidgets.comChristopher,
Thank you by the way, I’ll try this way.
Another checkbox column which value is shown for me? False or true?By default if you haven’t set the state of the checkbox it’s state is false. If it’s checked it’s true. You can check the state using one of the two properties of the jqxGrid i mentioned in my frst post.
Best Regards,
ChristopherjQWidgets Team
http://www.jqwidgets.comHello,
I successfully managed to obtain the values of the checked columns on each line.
I have checked these states in an array, I’m just not able to set the same rows and columns based on this array, which the command line to set the column of a row?If you add the retrieved values of the checkboxes in an array you can easily recognize which value to which row applies, because the jqxGrid rows start from 0 and are also represented as an Array. If you have multiple checkboxes per row, maybe you could use a two dimensional array or a map to store the values of each row.
Best Regards,
ChristopherjQWidgets Team
http://www.jqwidgets.comChristopher,
I am using matrizbidimensional to mount the grid, and have multiple checkboxes per line, and can store the row, column, and the state in this array:
bateriaperg.push({‘linha’:xlinha, ‘coluna’:xcolumn, ‘estado’:true, ‘escolha’:arraycolumn[xcolumn]});I need to reassemble the grid with true checkboxes based on the array ‘bateriaperg’, how do I to set based on this code that is working for me:
Function inicializador() Dim data1, source1, dataAdapter1 arraylinhas =["Honda", "Toyota", "Fiat", "VW", "Chevrolett", "Kia", "Hyunday", "Peugeot"]; arraycolumn =["Items","Branco","Preto","Prata","Cinza","Marrom","Vermelho"]; data1 = generatedata(arraylinhas) source1 = {localdata: data1, datatype: "array"}; dataAdapter1 = new $.jqx.dataAdapter(source1); NSB.jqxSettings["Grid5"].source = dataAdapter1; cln=[] For i=0 To UBound(arraycolumn) If i=0 Then cln[i]={ text: arraycolumn[i], editable: False, datafield: arraycolumn[i], width: 200 } Else cln[i]={ text: arraycolumn[i], datafield: arraycolumn[i], type: "bool", columntype: "checkbox", width: 200 } End If Next NSB.jqxSettings["Grid5"].columns = cln $("#Grid5").jqxGrid(NSB.jqxSettings["Grid5"]); End Function function generatedata(myarrayli) { var data = new Array(); var linharray=myarrayli for (var wl = 0; wl < linharray.length; wl++) { var row = {}; row["Items"] = linharray[wl]; data[wl] = row; } return data; }
You can use the
setcellvalue
function to set the checkbox values of each row. The method takesrowBoundIndex
,dataField
andvalue
as input parameters so you need to store information about those fields in the array that you create. Then onready
method, you call thesetcellvalue
function and pass each record from the array to the function. You can get the row bound index using thegetrowboundindex
method.Best Regards,
ChristopherjQWidgets Team
http://www.jqwidgets.comChristopher,
Thanks for support, try the way you suggest.
-
AuthorPosts
You must be logged in to reply to this topic.