浏览代码

오름차순

whakdo963 2 年之前
父节点
当前提交
7afb2b5fd0

+ 36 - 0
src/main/webapp/js/app/popup/biz/ITP_BIZPOP_PO_STOCK_HIST.js

@@ -112,6 +112,42 @@ function itp_fn_BIZPOP_PO_STOCK_HIST(parentPopFn, args, returnType) {
112 112
 		multiselect: false,
113 113
 		loadComplete: function(data) {
114 114
 			itp_fn_grid_load_complete(data, THIS_GIRD_ID, true, undefined, 'BIZPOP_PO_STOCK_HIST', itp_BIZPOP_PO_STOCK_HIST_search, itp_fn_BIZPOP_PO_STOCK_HIST_empty, true, data.gridRecords, false);
115
+			const self=this;
116
+			if(self.sortUse) return;
117
+			self.sortUse=true;
118
+			$(STOCK_MNG_HIST_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').css('cursor','default');
119
+			$(STOCK_MNG_HIST_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').eq(2).css('cursor','pointer');
120
+			$(STOCK_MNG_HIST_GRID_LIST).find('.ui-jqgrid-labels>th').on('click', function() {
121
+				const idx=$(this).index();
122
+				console.log("xxxx grid header click xxxxxxx index=="+idx, param );
123
+				if(idx==2 || idx==3) {
124
+					var field='',sort=self['sort'+idx];
125
+					if(sort ) {
126
+						sort=sort=='asc'?'desc':'asc';
127
+					} else {
128
+						// 등록일 내림차순, 제목 오름차순
129
+						sort=idx==2? 'asc':idx==3? 'desc': 'asc';
130
+					}
131
+					const icon=sort=='asc'? '.glyphicon-triangle-bottom': '.glyphicon-triangle-top'; 
132
+					self['sort'+idx]=sort;
133
+					if(idx==2) {
134
+						field='sysRegDttm';
135
+					} else if(idx==3) {
136
+						field='pchPodrDtlNo';
137
+					}
138
+					param.page=1;
139
+					param.sidx=field;
140
+					param.sord=sort;
141
+					
142
+					$(STOCK_MNG_HIST_GRID_ID).jqGrid('setGridParam',{
143
+						postData:JSON.stringify(param)
144
+					}).trigger('reloadGrid');
145
+					$(this).find('.s-ico').show();
146
+					$(this).find('.ui-grid-ico-sort').hide();
147
+					$(this).find(icon).show();
148
+
149
+				}
150
+			});
115 151
 	    },
116 152
 	    loadError: function(jqXHR, textStatus, errorThrown) {
117 153
 	    	itp_fn_grid_load_error(jqXHR, textStatus, errorThrown);

+ 40 - 12
src/main/webapp/js/app/stockmng/ITP_STOCKMNG01010.js

@@ -33,18 +33,6 @@ let LOGIN_AUTH_TYPE_CD;
33 33
 /*화면 Grid ColModel*/
34 34
 const gridColModel = {
35 35
 	list: [
36
-		{
37
-			index: 'BRAND_ID', name: 'brandId',
38
-			label: "브랜드ID", 
39
-			width: '0', fixed: false, align: 'center',
40
-			sortable: false, hidden: true
41
-		},
42
-		{
43
-			index: 'LOCATION', name: 'location',
44
-			label: "로케이션", 
45
-			width: '0', fixed: false, align: 'center',
46
-			sortable: false, hidden: true
47
-		},
48 36
 		{
49 37
 			index: 'WHS_ID', name: 'whsId',
50 38
 			label: "창고번호", 
@@ -400,6 +388,46 @@ let listObj = {
400 388
 						// $(STOCKMNG01010_GRID_ID).jqGrid('setCell', rowId, 'whsNm', '', ITP_GRID_COL_STYLE.link);
401 389
 					});
402 390
 					$('#cb_ITP_STOCKMNG01010_jqGrid').hide();
391
+					const self=this;
392
+					if(self.sortUse) return;
393
+					self.sortUse=true;
394
+					$(STOCKMNG01010_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').css('cursor','default');
395
+					$(STOCKMNG01010_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').eq(1).css('cursor','pointer');
396
+					$(STOCKMNG01010_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').eq(3).css('cursor','pointer');
397
+					$(STOCKMNG01010_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').eq(5).css('cursor','pointer');
398
+					$(STOCKMNG01010_GRID_LIST).find('.ui-jqgrid-labels>th').on('click', function() {
399
+						const idx=$(this).index();
400
+						console.log("xxxx grid header click xxxxxxx index=="+idx, param );
401
+						if(idx==1 || idx==3 || idx==5) {
402
+							var field='',sort=self['sort'+idx];
403
+							if(sort ) {
404
+								sort=sort=='asc'?'desc':'asc';
405
+							} else {
406
+								// 등록일 내림차순, 제목 오름차순
407
+								sort=idx==1? 'asc':idx==3? 'desc': 'asc';
408
+							}
409
+							const icon=sort=='asc'? '.glyphicon-triangle-bottom': '.glyphicon-triangle-top'; 
410
+							self['sort'+idx]=sort;
411
+							if(idx==1) {
412
+								field='whsId';
413
+							} else if(idx==3) {
414
+								field='locationNm';
415
+							} else if(idx==5) {
416
+								field='itemNm';
417
+							} 
418
+							param.page=1;
419
+							param.sidx=field;
420
+							param.sord=sort;
421
+							
422
+							$(STOCKMNG01010_GRID_ID).jqGrid('setGridParam',{
423
+								postData:JSON.stringify(param)
424
+							}).trigger('reloadGrid');
425
+							$(this).find('.s-ico').show();
426
+							$(this).find('.ui-grid-ico-sort').hide();
427
+							$(this).find(icon).show();
428
+
429
+						}
430
+					});
403 431
 				},
404 432
 				onPaging: function(action) {
405 433
 					var param=$(STOCKMNG01010_GRID_ID).data('grid-param');