<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
              <!-- Page Body -->
        <div id="DataTables_Table_0_wrapper" class="dataTables_wrapper dt-bootstrap5 no-footer">
			<table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0">
				<thead>
					<tr><th class="sorting sorting_asc" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="2" aria-sort="ascending" style="">시군구</th>
						<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="2" style="">기관</th>
						<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="2" style="">부서</th>
					</tr>
                   </thead>
                   <tbody id="sggDeptList">
					</tbody>
                  	<template id="sggDeptRow">
                  	<tr data-key="{dataKey}">
                      <td onclick="sggDepts.setCurrent('{dataKey}')">{SGG_CD}</td>
                      <td onclick="sggDepts.setCurrent('{dataKey}')">{SGG_NM}</td>
                      <td onclick="sggDepts.setCurrent('{dataKey}')">{INST_CD}</td>
                      <td onclick="sggDepts.setCurrent('{dataKey}')">{INST_NM}</td>
                      <td onclick="sggDepts.setCurrent('{dataKey}')">{DEPT_CD}</td>
                      <td onclick="sggDepts.setCurrent('{dataKey}')">{DEPT_NM}</td>
                   </tr>
                   </template>
                  	<template id="sggDeptNotFound">
				<tr class="odd">
					<td valign="top" colspan="4" class="dataTables_empty text-center">부서정보를 찾지 못했습니다.</td>
				</tr>
                   </template>
			</table>
		</div>
              <!--/ Page Body -->
<script >
var sggDepts = new Dataset({
	keymapper: info => info.dataKey,
	onDatasetChange: obj => {
		let empty = sggDepts.empty;
		
		let trs = empty ?
			[document.getElementById("sggDeptNotFound").innerHTML] : <%-- from template#${infoPrefix}NotFound --%>
			sggDepts.inStrings(document.getElementById("sggDeptRow").innerHTML); <%-- from template#${infoPrefix}Row --%>
		$("#sggDeptList").html(trs.join());
	},
	onCurrentChange: item => {
		if (!item) return;
		
		let key = item.data.dataKey;
		$("#sggDeptList").setCurrentRow(key);
	}
});

function getSelectedDept() {
	return sggDepts.getCurrent();
}

sggDepts.setData(${sggDepts});
//# sourceURL=select-sggDepts.jsp
</script>