jQWidgets Forums

jQuery UI Widgets Forums Grid Grid checkbox checked columns

This topic contains 8 replies, has 2 voices, and was last updated by  lsmarco2008@gmail.com 8 years, 7 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
  • Grid checkbox checked columns #88170

    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.

    Grid with checkbox

    Grid checkbox checked columns #88201

    Christopher
    Participant

    Hi lsmarco2008@gmail.com,

    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 the getrowdata 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,
    Christopher

    jQWidgets Team
    http://www.jqwidgets.com

    Grid checkbox checked columns #88216

    Christopher,
    Thank you by the way, I’ll try this way.
    Another checkbox column which value is shown for me? False or true?

    Grid checkbox checked columns #88223

    Christopher
    Participant

    Hi lsmarco2008@gmail.com,

    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,
    Christopher

    jQWidgets Team
    http://www.jqwidgets.com

    Grid checkbox checked columns #88400

    Hello,

    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?

    Grid checkbox checked columns #88432

    Christopher
    Participant

    Hi lsmarco2008@gmail.com,

    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,
    Christopher

    jQWidgets Team
    http://www.jqwidgets.com

    Grid checkbox checked columns #88444

    Christopher,

    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;
     }
           
      
    Grid checkbox checked columns #88457

    Christopher
    Participant

    Hi lsmarco2008@gmail.com,

    You can use the setcellvalue function to set the checkbox values of each row. The method takes rowBoundIndex, dataField and value as input parameters so you need to store information about those fields in the array that you create. Then onreadymethod, you call thesetcellvaluefunction and pass each record from the array to the function. You can get the row bound index using thegetrowboundindex method.

    Best Regards,
    Christopher

    jQWidgets Team
    http://www.jqwidgets.com

    Grid checkbox checked columns #88473

    Christopher,

    Thanks for support, try the way you suggest.

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.