Create the best Web experiences in browsers and devices with our user interface controls designed expressly for jQuery, ASP.NET MVC, HTML 5 and CSS 3. You’ll be building on a solid and proven foundation without any plug-ins or extensions, just real world best practices and the most forward-thinking, robust Web technology.

Infragistics NetAdvantage jQuery API Reference

ui.igGridMergedCells

ui.igGridMergedCells_image

Merged cell feature of the igGrid allows you to combine cells in a column that are next to each other and have the same values. This is very useful after a column is sorted, because the cells that have the same values are merged.

The following code snippet demonstrates how to initialize the igGrid control.

Click here for more information on how to get started using this API. For details on how to reference the required scripts and themes for the igGrid control read, Using JavaScript Resouces in NetAdvantage for jQuery and Styling and Theming NetAdvantage for jQuery.

Code Sample

 
<!doctype html>
<html>
<head>
    <!-- jQuery Core -->
    <script src="js/jquery.js" type="text/javascript"></script>
	<!-- jQuery Mobile -->
    <script src="js/jquery.mobile.js" type="text/javascript"></script>
	<!-- Moderznizr -->
    <script src="js/modernizr.js" type="text/javascript"></script>
    <!-- jQuery UI -->
    <script src="js/jquery-ui.js" type="text/javascript"></script>
    <!-- Infragistics Loader Script -->
    <script src="js/infragistics.loader.js" type="text/javascript"></script>    
	<!-- Infragistics Loader Initialization -->
    <script type="text/javascript">
		$.ig.loader({
			scriptPath: 'js/',
			cssPath: 'css/',
			resources: 'igGrid.Paging.Selection.MergedCells.Sorting.Updating'
		})
		
		var productData = [
			{ "ProductID": "1", "UnitsInStock": "100", "ProductDescription": "Laptop", "UnitPrice": "$ 1000" , "DateAdded": new Date() },
			{ "ProductID": "2", "UnitsInStock": "15", "ProductDescription": "Hamburger", "UnitPrice": "$ 10", "DateAdded": new Date() },
			{ "ProductID": "3", "UnitsInStock": "4356", "ProductDescription": "Beer", "UnitPrice": "$ 1000", "DateAdded": new Date() },
			{ "ProductID": "4", "UnitsInStock": "32", "ProductDescription": "mobile phone", "UnitPrice": "$ 1000", "DateAdded": new Date() },
			{ "ProductID": "5", "UnitsInStock": "65", "ProductDescription": "trainers", "UnitPrice": "$ 1000", "DateAdded": new Date() },
			{ "ProductID": "6", "UnitsInStock": "25", "ProductDescription": "coffee cup", "UnitPrice": "$ 1000", "DateAdded": new Date() },
			{ "ProductID": "7", "UnitsInStock": "98", "ProductDescription": "BMW 323 CI", "UnitPrice": "$ 1000", "DateAdded": new Date() },
			{ "ProductID": "8", "UnitsInStock": "998", "ProductDescription": "mouse", "UnitPrice": "$ 1000", "DateAdded": new Date() },
			{ "ProductID": "9", "UnitsInStock": "43", "ProductDescription": "keyboard", "UnitPrice": "$ 1000", "DateAdded": new Date() },
			{ "ProductID": "10", "UnitsInStock": "69", "ProductDescription": "fish", "UnitPrice": "$ 1000", "DateAdded": new Date() },
			{ "ProductID": "11", "UnitsInStock": "100", "ProductDescription": "Laptop", "UnitPrice": "$ 1000" , "DateAdded": new Date() },
			{ "ProductID": "12", "UnitsInStock": "15", "ProductDescription": "Hamburger", "UnitPrice": "$ 10", "DateAdded": new Date() },
			{ "ProductID": "13", "UnitsInStock": "4356", "ProductDescription": "Beer", "UnitPrice": "$ 1000", "DateAdded": new Date() },
			{ "ProductID": "14", "UnitsInStock": "32", "ProductDescription": "mobile phone", "UnitPrice": "$ 1000", "DateAdded": new Date() },
			{ "ProductID": "15", "UnitsInStock": "65", "ProductDescription": "trainers", "UnitPrice": "$ 1000", "DateAdded": new Date() },
			{ "ProductID": "16", "UnitsInStock": "25", "ProductDescription": "coffee cup", "UnitPrice": "$ 1000", "DateAdded": new Date() },
			{ "ProductID": "17", "UnitsInStock": "98", "ProductDescription": "BMW 323 CI", "UnitPrice": "$ 1000", "DateAdded": new Date() },
			{ "ProductID": "18", "UnitsInStock": "998", "ProductDescription": "BMW 323 CI", "UnitPrice": "$ 1000", "DateAdded": new Date() },
			{ "ProductID": "19", "UnitsInStock": "43", "ProductDescription": "keyboard", "UnitPrice": "$ 1000", "DateAdded": new Date() },
			{ "ProductID": "20", "UnitsInStock": "69", "ProductDescription": "fish", "UnitPrice": "$ 1000", "DateAdded": new Date() },
		];
		
		$.ig.loader(function () {
			$("#grid1").igGrid({
				dataSource: productData,
				responseDataKey: "ProductID",
				fixedFooters: false,
				fixedHeaders: true,
				virtualization: false,
				autoGenerateColumns: false,
				width: 600,
				defaultColumnWidth: 140,
				columns: [
					{ headerText: "Product ID", key: "ProductID", dataType: "number", width: 100},
					{ headerText: "Units in Stock", key: "UnitsInStock", dataType: "number", width: 150},
					{ headerText: "Product Description", key: "ProductDescription", dataType: "string", width: 150},
					{ headerText: "Unit Price", key: "UnitPrice", dataType: "string", width: 150 }
				],
				features: [
					{
						name: "MergedCells",
						initialState: "merged"
					},
					{
						name: "Selection",
						mouseDragSelect: true,
						multipleSelection: true,
						mode: "cell",
						continuousSelection: true
					},
					{
						name: "Paging",
						pageSize: 10,
						type: "local"
					},
					{
						name: "Sorting",
						type: "local",
						mode: "multiple"
					}
				]
			});
		});
	</script>
</head>
<body>
	<table id="grid1"></table>
</body>
    

Dependencies

jquery-1.4.4.js
jquery.ui.core.js
jquery.ui.widget.js
ig.ui.grid.framework.js
ig.ui.shared.js
ig.datasource.js
ig.util.js
  • initialState

    Type:
    enumeration
    Default:
    regular

    controls the initial state .

    Members

    • regular
    • Type:string
    • the grid won't be initialized with cells merged.
    • merged
    • Type:string
    • the grid will be initialized with cells merged.

    Code Sample

     
            //Initialize
            $(".selector").igGrid({
                features : [
                    {
                        name : "MergedCells",
                        initialState: "merged"
                    }
                ]
            });
            
            //Get
            var state = $(".selector").igGridMergedCells("option", "initialState");
          

For more information on how to interact with the NetAdvantage for jQuery controls events, refer to
Using Events in NetAdvantage for jQuery

Show Details
  • cellsMerged

    Cancellable:
    false

    Use ui.row to get reference to the row the merged group starts in.
    Use ui.rowIndex to get the index of the row the merged group starts in.
    Use ui.rowKey to get the key of the row the merged group starts in.
    Use ui.owner to get reference to igGridMergedCells.
    Use ui.grid to get reference to the igGrid the igGridMergedCells are initialized for.
    Use ui.value to get the cells value which is repeated and caused the merged group to be created.
    Use ui.count to get the total count of cells that were merged.

    Code Sample

     
            //Bind after initialization		
    		$(document).delegate(".selector", "iggridmergedcellscellsmerged", function (evt, ui) { 
                //return the triggered event
                evt;
                
                // Get reference to the row the merged group starts in.
                ui.row;
                
                // Get the index of the row the merged group starts in.
                ui.rowIndex;
                
                // Get the key of the row the merged group starts in.
                ui.rowKey;
                
                // Get reference to igGridMergedCells widget.
                ui.owner;
                
                // Get reference to the igGrid the igGridMergedCells are initialized for.
                ui.grid;
                
                // Get the cells value which is repeated and caused the merged group to be created.
                ui.value;
                
                // Get the total count of cells that were merged.
                ui.count;
            
            });
            
            //Initialize
            $(".selector").igGrid({
                features : [
                    {
                        name : "MergedCells",
    					cellsMerged: function(evt, ui){ ... }
                    }
                ]
            });
          
  • cellsMerging

    Cancellable:
    true

    Event fired before a new merged cells group is created.
    Function takes arguments evt and ui.
    Use ui.row to get reference to the row the merged group starts in.
    Use ui.rowIndex to get the index of the row the merged group starts in.
    Use ui.rowKey to get the key of the row the merged group starts in.
    Use ui.owner to get reference to igGridMergedCells.
    Use ui.grid to get reference to the igGrid the igGridMergedCells are initialized for.
    Use ui.value to get the cells value which is repeated and caused the merged group to be created.

    Code Sample

     
            //Bind after initialization		
    		$(document).delegate(".selector", "iggridmergedcellscellsmerging", function (evt, ui) { 
                //return the triggered event
                evt;
                
                // Get reference to the row the merged group starts in.
                ui.row;
                
                // Get the index of the row the merged group starts in.
                ui.rowIndex;
                
                // Get the key of the row the merged group starts in.
                ui.rowKey;
                
                // Get reference to igGridMergedCells widget.
                ui.owner;
                
                // Get reference to the igGrid the igGridMergedCells are initialized for.
                ui.grid;
                
                // Get the cells value which is repeated and caused the merged group to be created.
                ui.value;
                
                // Get the total count of cells that were merged.
                ui.count;
            
            });
            
            //Initialize
            $(".selector").igGrid({
                features : [
                    {
                        name : "MergedCells",
    					cellsMerging: function(evt, ui){ ... }
                    }
                ]
            });
          
  • destroy

    .igGridMergedCells( "destroy" );

    Code Sample

     $(".selector").igGridMergedCells("destroy"); 
  • ui-iggrid-mergedcell

    Classes applied to every cell of a merged group.
  • ui-iggrid-mergedcellsbottom

    Classes applied to the bottom cell of a merged group.
  • ui-iggrid-mergedcellstop

    Classes applied to the top cell of a merged group.