igGrid - export selected rows

by georgianastasov

HTML

<script src="https://igniteui.com/js/modernizr.min.js"></script>
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="https://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>
<script src="https://igniteui.com/js/external/FileSaver.js"></script>
<script src="https://igniteui.com/js/external/Blob.js"></script>
<script src="https://cdn-na.infragistics.com/igniteui/latest/js/infragistics.core.js"></script>
<script src="https://cdn-na.infragistics.com/igniteui/latest/js/infragistics.lob.js"></script>
<script src="https://cdn-na.infragistics.com/igniteui/latest/js/infragistics.excel-bundled.js"></script>
<script src="https://cdn-na.infragistics.com/igniteui/latest/js/modules/infragistics.gridexcelexporter.js"></script>
<link href="https://cdn-na.infragistics.com/igniteui/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet"></link>
<link href="https://cdn-na.infragistics.com/igniteui/latest/css/structure/infragistics.css" rel="stylesheet"></link>

<div>
  <table id="grid"></table>
</div>

<button id="saveChanges" class="btn btn-primary" style="margin-top:1rem;">Save</button>
<button id="export" class="btn btn-primary" style="margin-top:1rem;">Export</button>

JavaScript

$(function () {
				var data = [{id: 779397, name: "Rohit", marsk: 100, subject: "Math"},{id: 779399, name: "Sareek", marsk: 50, subject: "Math"}]
        
				$("#grid").igGrid({
					primaryKey: "id",
					renderCheckboxes: true,
					autoGenerateColumns: false,
					width: "100%",
          height: "300px",
					columns: [
							{ headerText: "Student ID", key: "id", dataType: "number", width: "15%" },
							{ headerText: "Student Name", key: "name", dataType: "string", width: "30%" },
							{ headerText: "Marks", key: "marks", dataType: "number", width: "30%" },
							{ headerText: "Subject", key: "subject", dataType: "string", width: "15%" }],
					dataSource: data,
					features: [{
							name: "Selection",
							mode: "row",
							multipleSelection: true
					},
					{
							name: "RowSelectors",
							enableRowNumbering: true
					},
					{
							name: "Filtering",
					},
					{
							name: "Sorting",
							type: "local",
					},
					{	
							name: "Updating",
							enableAddRow: true,
							editMode: "row",
							validation: true,
							enableDeleteRow: true,
							columnSettings: [
							{
									columnKey: "id",
									readOnly: true

							},
							{
									columnKey: "name",
									editorType: "text",
									validation: true,
									editorOptions: {
											validatorOptions:
											{
													required: {
															errorMessage: "You must enter a value to submit."

													},
													custom: function(ui,evt)
                          {
															var validator = $("#grid").igGridUpdating("editorForKey", "name").data("igValidator").element;
															if (ui == "rohit") {
																	$(validator).igValidator("option", "errorMessage", "cant enter name rohit");
																	return false;
															}
															return true;
													}
										}
								}
						},
						{
								columnKey: "marks",
								editorType: "combo",
								validation:...