모니터링 프로퍼티 검색 기능 추가
This commit is contained in:
@@ -306,6 +306,45 @@ var lastsel2;
|
||||
|
||||
buttonControl(key);
|
||||
titleControl(key);
|
||||
|
||||
// 검색 기능
|
||||
$("#btn_search").click(function() {
|
||||
filterGrid();
|
||||
});
|
||||
|
||||
// 엔터키로 검색
|
||||
$("#searchText").keypress(function(e) {
|
||||
if (e.which == 13) {
|
||||
filterGrid();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// 초기화 버튼
|
||||
$("#btn_reset").click(function() {
|
||||
$("#searchText").val("");
|
||||
filterGrid();
|
||||
});
|
||||
|
||||
function filterGrid() {
|
||||
var searchText = $("#searchText").val().toLowerCase();
|
||||
var grid = $("#grid");
|
||||
|
||||
// 모든 행을 순회하며 필터링
|
||||
var ids = grid.jqGrid('getDataIDs');
|
||||
for (var i = 0; i < ids.length; i++) {
|
||||
var rowData = grid.jqGrid('getRowData', ids[i]);
|
||||
var prptyName = (rowData.PRPTYNAME || "").toLowerCase();
|
||||
var prptyVal = (rowData.PRPTY2VAL || "").toLowerCase();
|
||||
|
||||
// 검색어가 비어있거나, 프로퍼티 키 또는 값에 포함되어 있으면 표시
|
||||
if (searchText === "" || prptyName.indexOf(searchText) >= 0 || prptyVal.indexOf(searchText) >= 0) {
|
||||
$("#" + ids[i]).show();
|
||||
} else {
|
||||
$("#" + ids[i]).hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
@@ -359,10 +398,36 @@ var lastsel2;
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- 검색 박스 추가 -->
|
||||
<div class="search-box">
|
||||
<input type="text" id="searchText" placeholder="<%= localeMessage.getString("propertyDetail.propertyKey") %> 또는 <%= localeMessage.getString("propertyDetail.propertyValue") %> 검색" />
|
||||
<button type="button" class="cssbtn smallBtn2" id="btn_search"><i class="material-icons">search</i> 검색</button>
|
||||
<button type="button" class="cssbtn smallBtn2" id="btn_reset"><i class="material-icons">refresh</i> 초기화</button>
|
||||
</div>
|
||||
|
||||
<!-- grid -->
|
||||
<table id="grid"></table>
|
||||
|
||||
</div><!-- end content_middle -->
|
||||
</div><!-- end right_box -->
|
||||
</div><!-- end right_box -->
|
||||
|
||||
<style>
|
||||
.search-box {
|
||||
margin: 10px 0;
|
||||
padding: 10px;
|
||||
background-color: #f5f5f5;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.search-box input[type="text"] {
|
||||
width: 300px;
|
||||
padding: 5px 10px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.search-box button {
|
||||
margin-left: 5px;
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user