Checkbox Selection Grid

To make the grid rows selectable, you need to install the ezEditTable extension, enable the selectable property and configure the ezEditTable configuration object (ezEditTable_config). This demo shows how to :

Note: keyboard navigation and selection are disabled in this demo.

 Id Name Email Start Date Salary
 29181Employee name...employee@email.com2011-01-010.00
 29180Employee name...employee@email.com2002-05-0123.00
 29179Employee name...employee@email.com2011-01-010.00
 29178Employee name...employee@email.com2011-01-010.00
 29177Employee name...employee@email.com2011-01-010.00
 29176Employee name...employee@email.com2011-01-010.00
 29175Employee name...employee@email.com2011-01-010.00
 29174asdfemployee@email.com2011-01-010.00
 29173Employee name...employee@email.com2011-01-010.00
 29172Employee name...employee@email.com2011-01-010.00
 29171sdgsdfsdfsdfemployee@email.com2011-01-010.00
 29170Employee name...employee@email.com2011-01-010.00
 29169Employee name...employee@email.com2011-01-010.00
 29168Employee name...employee@email.com2011-01-010.00
 29167Employee name...employee@email.com2011-01-010.00
 29166Employee name...employee@email.com2011-01-010.00
 29165Employee name...employee@email.com2011-01-010.00
 29164Employee name...employee@email.com2011-01-010.00
 29163Employee name...employee@email.com2011-01-010.00
 29162Employee name...employee@email.com2011-01-010.00
 29161Employee name...employee@email.com2011-01-010.00
 29159Employee name...employee@email.com2011-01-010.00
 29157Employee name...employee@email.com2011-01-010.00
 29154Employee name...employee@email.com2011-01-010.00
 29153Employee name...employee@email.com2011-01-010.00
 29152Employee name...employees@email.com2011-01-010.00
 29151Employee name...employee@email.com2011-01-010.00
 29150Employee name...employee@email.com2011-01-010.00
 29149Employee name...employee@email.com2011-01-010.00
 29148Employee name...employee@email.com2011-01-010.00
 29147Employee name...employee@email.com2011-01-010.00
 29146Employee name...employee@email.com2011-01-010.00
 29145Employee name...employee@email.com2011-01-010.00
 29144Employee name...employee@email.com2011-01-010.00
 29143Employee name...employee@email.com2011-01-010.00
 29142Employee name...employee@email.com2011-01-010.00
 29141Employee name...employee@email.com2011-01-010.00
 29140Employee name...employee@email.com2011-01-010.00
 29139Employee name...employee@email.com2011-01-010.00
 29138Employee name...employee@email.com2011-01-010.00
 29137Employee name...employee@email.com2011-01-010.00
 29136Employee name...employee@email.com2011-01-010.00
 29135Employee name...employee@email.com2011-01-010.00
 29134Employee name...employee@email.com2011-01-010.00
 29133Employee name...employee@email.com2011-01-010.00
 29132Employee name...employee@email.com2011-01-010.00
 29131Employee name...employee@email.com2011-01-010.00
 29130Employee name...employee@email.com2011-01-010.00
 29129Employee name...employee@email.com2011-01-010.00
 29128Employee name...employee@email.com2011-01-010.00
 29127asaemployee@email.com2011-01-010.00
 29126Employee name...employee@email.com2011-01-010.00
 29124Employee name...employee@email.com2011-01-010.00
 29123Employee name...employee@email.com2011-01-010.00
 29122Employee name...employee@email.com2011-01-010.00
 29121Employee name...employee@email.com2011-01-010.00
 29120Employee name...employee@email.com2011-01-010.00
 29119Employee name...employee@email.com2011-01-010.00
 29118Employee name...employee@email.com2011-01-010.00
 29117Employee name...employee@email.com2011-01-010.00
 29116Employee name...employee@email.com2011-01-010.00
 29115Employee name...employee@email.com2011-01-010.00
 29114Employee name...employee@email.com2011-01-010.00
 29113Employee name...employee@email.com2011-01-010.00
 29112Employee name...employee@email.com2011-01-010.00
 29111Employee name...employee@email.com2011-01-010.00
 29110Employee name...employee@email.com2011-01-010.00
 29108Employee name...jom@e.com2011-01-010.00
 29107Employee name...employee@email.com2011-01-010.00
 29106Employee name...employee@email.com2011-01-010.00
 29105Employee name...employee@email.com2011-01-010.00
 29104Employee name...employee@email.com2011-01-010.00
 29102Employee name...employee@email.com2011-01-010.00
 29100Employee name...employee@email.com2011-01-010.00
 29099Employee name...employee@email.com2011-01-010.00
 29098Employee name...employee@email.com2011-01-010.00
 29097Employee name...employee@email.com2011-01-0125.00
 29094Employee name...employee@email.com2011-01-010.00
 29092Employee name...employee@email.com2011-01-010.00
 29091Employee name...employee@email.com2011-01-010.00
 29090Employee name...employee@email.com2011-01-0112.00
 29089Employee name...employee@email.com2011-01-010.00
 29088Employee name...employee@email.com2011-01-010.00
 29087Employee name...employee@email.com2011-01-0123.36
 29086Employee name...employee@email.com2011-01-010.00
 29083Employee name...employee@email.com2007-01-010.00
 29082ASemployee@email.com2011-01-010.00
 29078Employee name...employee@email.com2011-01-010.00
 29077Bonjouremployee@email.com2011-01-010.00
 29075Employee name...employee@e123mail.com2011-01-010.00
 29074Employee name...employee@email.com2011-01-010.00
 29073Employee name...employee@email.com2011-01-010.00
 29072Employee name...employee@email.com2011-01-010.00
 29070Employee name...employee@email.com2011-01-010.00
 29067Employee name...employee@email.com2011-01-010.00
 29066saurabhssssssssssaurabh@gmail.com2011-01-010.00
 29065Employee name...employee@email.com2011-01-010.00
 29064saurabhsaurabh@gmail.com2011-01-010.00
 29063Employee name...employee@email.com2011-01-010.00
 29061thingemployee@email.com2011-01-010.00
		var tfConfig = {
			public_methods: true,
			btn_reset: true,
			alternate_rows: true,
			loader: true,
			rows_counter: true,
			paging: false,
			col_0: 'none',
			col_width:['70px', '50px', '280px', '220px', '100px', '100px'],
			col_date_type: [null, null, null, null, 'ymd', null],
			sort_config: { sort_types: ['number','string','string','ymd','number'] },
			grid_layout: true, grid_width: '840px', grid_height: '300px',
			grid_enable_cols_resizer: false,
			mark_active_columns: true,
			
			//Checkbox header is referenced once filters are generated
			on_filters_loaded: function(o){
				var headersRow = o.headTbl.rows[o.GetHeadersRowIndex()];
				var c = headersRow.cells[0];
				var ezConfig = o.fObj.ezEditTable_config;
				//header checkbox is referenced on ezEditTable configuration object o.ezEditTable.checkBoxAll
				ezConfig.checkBoxAll = tf_Tag(c, 'input')[0];
				//header checkbox always unselected at start
				ezConfig.checkBoxAll.checked = false;
				//Click event is attached to header checkbox, note o.fObj = TF configuration object
				tf_AddEvent(ezConfig.checkBoxAll, 'click', function(e){ o.fObj.toggleAll(o); });
			},
			
			selectable: true,
			editable: false,
			ezEditTable_config: {
				key_navigation: false,
				key_selection: false,
				selection_model: 'multiple',
				default_selection: 'row',
				selected_row_css: 'ezSlcRow',
				
				on_after_selected_row: function(o, row){
					var c = row.cells[0];
					var checkBox = o.Tag(c, 'input')[0];
					if(checkBox) checkBox.checked = true;
				},
				on_after_deselected_row: function(o, row){
					var c = row.cells[0];
					var checkBox = o.Tag(c, 'input')[0];
					if(checkBox) checkBox.checked = false;
					o.config.checkBoxAll.checked = false;
				}
			},
			
			/* Sky Blue theme */  
			themes: {   
				name:['SkyBlueTheme'],   
				src:['TableFilter/TF_Themes/SkyBlue/TF_SkyBlue.css'],   
				description:['SkyBlue stylesheet']
			},
			
			//Custom select all function used by header checkbox
			toggleAll: function(tf){ //tf = parent object: TF
				var o = tf.ezEditTable; //ezEditTable object referenced inside TF object
				if(o.config.checkBoxAll.checked == false){
					o.Selection.ClearSelections();
				} else {
					for(var i=o.startRow; i<o.GetRowsNb(); i++){
						//If table filtered, only valid rows are selected
						if(tf.GetValidRowsIndex()==null || tf.GetValidRowsIndex().indexOf(i) != -1)
							o.Selection.SelectRowByIndex(i);
					}
				}
			}
		};
		

E.n.j.o.y.  ads-free content!