Browse Source

그리드 오츰차순

whakdo963 2 years ago
parent
commit
484111e4e0

+ 37 - 0
src/main/webapp/js/app/stinfo/ITP_STINFO01010.js

@@ -289,6 +289,43 @@ let listObj = {
289 289
                     $.each(ids, function(idx, rowId) {
290 290
                         $(STINFO01010_GRID_ID).jqGrid('setCell', rowId, 'brandId', '', ITP_GRID_COL_STYLE.link);
291 291
                     });
292
+                    const self=this;
293
+					if(self.sortUse) return;
294
+					self.sortUse=true;
295
+					$(OPER02010_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').css('cursor','default');
296
+					$(OPER02010_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').eq(2).css('cursor','pointer');
297
+					$(OPER02010_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').eq(8).css('cursor','pointer');
298
+					$(OPER02010_GRID_LIST).find('.ui-jqgrid-labels>th').on('click', function() {
299
+						const idx=$(this).index();
300
+						console.log("xxxx grid header click xxxxxxx index=="+idx, param );
301
+						if(idx==2 || idx==8 ) {
302
+							var field='',sort=self['sort'+idx];
303
+							if(sort ) {
304
+								sort=sort=='asc'?'desc':'asc';
305
+							} else {
306
+								// 등록일 내림차순, 제목 오름차순
307
+								sort=idx==2? 'asc':idx==8? 'desc': 'asc';
308
+							}
309
+							const icon=sort=='asc'? '.glyphicon-triangle-bottom': '.glyphicon-triangle-top'; 
310
+							self['sort'+idx]=sort;
311
+							if(idx==2) {
312
+								field='nticeTitl';
313
+							} else if(idx==8) {
314
+								field='addDt';
315
+							} 
316
+							param.page=1;
317
+							param.sidx=field;
318
+							param.sord=sort;
319
+							
320
+							$(OPER02010_GRID_ID).jqGrid('setGridParam',{
321
+								postData:JSON.stringify(param)
322
+							}).trigger('reloadGrid');
323
+							$(this).find('.s-ico').show();
324
+							$(this).find('.ui-grid-ico-sort').hide();
325
+							$(this).find(icon).show();
326
+
327
+						}
328
+					});
292 329
                 },
293 330
                 onPaging: function(action) {
294 331
                     itp_fn_grid_paging(STINFO01010_GRID_ID, action, param);

+ 37 - 0
src/main/webapp/js/app/stinfo/ITP_STINFO02010.js

@@ -389,6 +389,43 @@ let listObj = {
389 389
 					$.each(ids, function(idx, rowId) {
390 390
 						$(STINFO02010_GRID_ID).jqGrid('setCell', rowId, 'storeId', '', ITP_GRID_COL_STYLE.link);
391 391
 					});
392
+					const self=this;
393
+					if(self.sortUse) return;
394
+					self.sortUse=true;
395
+					$(STINFO02010_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').css('cursor','default');
396
+					$(STINFO02010_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').eq(2).css('cursor','pointer');
397
+					$(STINFO02010_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').eq(4).css('cursor','pointer');
398
+					$(STINFO02010_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==2 || idx==4 ) {
402
+							var field='',sort=self['sort'+idx];
403
+							if(sort ) {
404
+								sort=sort=='asc'?'desc':'asc';
405
+							} else {
406
+								// 등록일 내림차순, 제목 오름차순
407
+								sort=idx==2? 'asc':idx==4? 'desc': 'asc';
408
+							}
409
+							const icon=sort=='asc'? '.glyphicon-triangle-bottom': '.glyphicon-triangle-top'; 
410
+							self['sort'+idx]=sort;
411
+							if(idx==2) {
412
+								field='storeNm';
413
+							} else if(idx==4) {
414
+								field='brandNm';
415
+							} 
416
+							param.page=1;
417
+							param.sidx=field;
418
+							param.sord=sort;
419
+							
420
+							$(STINFO02010_GRID_ID).jqGrid('setGridParam',{
421
+								postData:JSON.stringify(param)
422
+							}).trigger('reloadGrid');
423
+							$(this).find('.s-ico').show();
424
+							$(this).find('.ui-grid-ico-sort').hide();
425
+							$(this).find(icon).show();
426
+
427
+						}
428
+					});
392 429
 				},
393 430
 				onPaging: function(action) {
394 431
 					itp_fn_grid_paging(STINFO02010_GRID_ID, action, param);

+ 37 - 0
src/main/webapp/js/app/stinfo/ITP_STINFO03010.js

@@ -443,6 +443,43 @@ let listObj = {
443 443
 					$.each(ids, function(idx, rowId) {
444 444
 						$(STINFO03010_GRID_ID).jqGrid('setCell', rowId, 'spplyId', '', ITP_GRID_COL_STYLE.link);
445 445
 					});
446
+					const self=this;
447
+					if(self.sortUse) return;
448
+					self.sortUse=true;
449
+					$(STINFO03010_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').css('cursor','default');
450
+					$(STINFO03010_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').eq(2).css('cursor','pointer');
451
+					$(STINFO03010_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').eq(4).css('cursor','pointer');
452
+					$(STINFO03010_GRID_LIST).find('.ui-jqgrid-labels>th').on('click', function() {
453
+						const idx=$(this).index();
454
+						console.log("xxxx grid header click xxxxxxx index=="+idx, param );
455
+						if(idx==2 || idx==4 ) {
456
+							var field='',sort=self['sort'+idx];
457
+							if(sort ) {
458
+								sort=sort=='asc'?'desc':'asc';
459
+							} else {
460
+								// 등록일 내림차순, 제목 오름차순
461
+								sort=idx==2? 'asc':idx==4? 'desc': 'asc';
462
+							}
463
+							const icon=sort=='asc'? '.glyphicon-triangle-bottom': '.glyphicon-triangle-top'; 
464
+							self['sort'+idx]=sort;
465
+							if(idx==2) {
466
+								field='spplyNm';
467
+							} else if(idx==4) {
468
+								field='brandNm';
469
+							} 
470
+							param.page=1;
471
+							param.sidx=field;
472
+							param.sord=sort;
473
+							
474
+							$(STINFO03010_GRID_ID).jqGrid('setGridParam',{
475
+								postData:JSON.stringify(param)
476
+							}).trigger('reloadGrid');
477
+							$(this).find('.s-ico').show();
478
+							$(this).find('.ui-grid-ico-sort').hide();
479
+							$(this).find(icon).show();
480
+
481
+						}
482
+					});
446 483
 				},
447 484
 				onPaging: function(action) {
448 485
 					itp_fn_grid_paging(STINFO03010_GRID_ID, action, param);

+ 36 - 0
src/main/webapp/js/app/stinfo/ITP_STINFO04010.js

@@ -733,6 +733,42 @@ let listObj = {
733 733
                     $.each(ids, function(idx, rowId) {
734 734
                         $(STINFO04010_GRID_ID).jqGrid('setCell', rowId, 'itemId', '', ITP_GRID_COL_STYLE.link);
735 735
                     });
736
+                    const self=this;
737
+					if(self.sortUse) return;
738
+					self.sortUse=true;
739
+					$(STINFO04010_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').css('cursor','default');
740
+					$(STINFO04010_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').eq(4).css('cursor','pointer');
741
+					$(STINFO04010_GRID_LIST).find('.ui-jqgrid-labels>th').on('click', function() {
742
+						const idx=$(this).index();
743
+						console.log("xxxx grid header click xxxxxxx index=="+idx, param );
744
+						if(idx==4 || idx==5 ) {
745
+							var field='',sort=self['sort'+idx];
746
+							if(sort ) {
747
+								sort=sort=='asc'?'desc':'asc';
748
+							} else {
749
+								// 등록일 내림차순, 제목 오름차순
750
+								sort=idx==4? 'asc':idx==5? 'desc': 'asc';
751
+							}
752
+							const icon=sort=='asc'? '.glyphicon-triangle-bottom': '.glyphicon-triangle-top'; 
753
+							self['sort'+idx]=sort;
754
+							if(idx==4) {
755
+								field='itemNm';
756
+							} else if(idx==5) {
757
+								field='brandNm';
758
+							} 
759
+							param.page=1;
760
+							param.sidx=field;
761
+							param.sord=sort;
762
+							
763
+							$(STINFO04010_GRID_ID).jqGrid('setGridParam',{
764
+								postData:JSON.stringify(param)
765
+							}).trigger('reloadGrid');
766
+							$(this).find('.s-ico').show();
767
+							$(this).find('.ui-grid-ico-sort').hide();
768
+							$(this).find(icon).show();
769
+
770
+						}
771
+					});
736 772
                 },
737 773
                 onPaging: function(action) {
738 774
                     itp_fn_grid_paging(STINFO04010_GRID_ID, action, param);

+ 36 - 0
src/main/webapp/js/app/stinfo/ITP_STINFO05010.js

@@ -489,6 +489,42 @@ let listObj = {
489 489
 						$(STINFO05010_GRID_ID).jqGrid('setCell', rowId, 'itemId', '', ITP_GRID_COL_STYLE.link);
490 490
 					});
491 491
 					$(STINFO05010_GRID_ID).jqGrid('hideCol', 'cb');
492
+					const self=this;
493
+					if(self.sortUse) return;
494
+					self.sortUse=true;
495
+					$(STINFO05010_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').css('cursor','default');
496
+					$(STINFO05010_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').eq(4).css('cursor','pointer');
497
+					$(STINFO05010_GRID_LIST).find('.ui-jqgrid-labels>th').on('click', function() {
498
+						const idx=$(this).index();
499
+						console.log("xxxx grid header click xxxxxxx index=="+idx, param );
500
+						if(idx==4 || idx==5 ) {
501
+							var field='',sort=self['sort'+idx];
502
+							if(sort ) {
503
+								sort=sort=='asc'?'desc':'asc';
504
+							} else {
505
+								// 등록일 내림차순, 제목 오름차순
506
+								sort=idx==4? 'asc':idx==5? 'desc': 'asc';
507
+							}
508
+							const icon=sort=='asc'? '.glyphicon-triangle-bottom': '.glyphicon-triangle-top'; 
509
+							self['sort'+idx]=sort;
510
+							if(idx==4) {
511
+								field='itemNm';
512
+							} else if(idx==5) {
513
+								field='brandNm';
514
+							} 
515
+							param.page=1;
516
+							param.sidx=field;
517
+							param.sord=sort;
518
+							
519
+							$(STINFO05010_GRID_ID).jqGrid('setGridParam',{
520
+								postData:JSON.stringify(param)
521
+							}).trigger('reloadGrid');
522
+							$(this).find('.s-ico').show();
523
+							$(this).find('.ui-grid-ico-sort').hide();
524
+							$(this).find(icon).show();
525
+
526
+						}
527
+					});
492 528
 				},
493 529
 				onPaging: function(action) {
494 530
 					itp_fn_grid_paging(STINFO05010_GRID_ID, action, param);

+ 36 - 0
src/main/webapp/js/app/stinfo/ITP_STINFO06010.js

@@ -646,6 +646,42 @@ let listObj = {
646 646
 					$.each(ids, function(idx, rowId) {
647 647
 						$(STINFO06010_GRID_ID).jqGrid('setCell', rowId, 'contSttDt', '', ITP_GRID_COL_STYLE.link);
648 648
 					});
649
+					const self=this;
650
+					if(self.sortUse) return;
651
+					self.sortUse=true;
652
+					$(STINFO06010_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').css('cursor','default');
653
+					$(STINFO06010_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').eq(3).css('cursor','pointer');
654
+					$(STINFO06010_GRID_LIST).find('.ui-jqgrid-labels>th').on('click', function() {
655
+						const idx=$(this).index();
656
+						console.log("xxxx grid header click xxxxxxx index=="+idx, param );
657
+						if(idx==3 || idx==5 ) {
658
+							var field='',sort=self['sort'+idx];
659
+							if(sort ) {
660
+								sort=sort=='asc'?'desc':'asc';
661
+							} else {
662
+								// 등록일 내림차순, 제목 오름차순
663
+								sort=idx==3? 'asc':idx==5? 'desc': 'asc';
664
+							}
665
+							const icon=sort=='asc'? '.glyphicon-triangle-bottom': '.glyphicon-triangle-top'; 
666
+							self['sort'+idx]=sort;
667
+							if(idx==3) {
668
+								field='itemNm';
669
+							} else if(idx==5) {
670
+								field='brandNm';
671
+							} 
672
+							param.page=1;
673
+							param.sidx=field;
674
+							param.sord=sort;
675
+							
676
+							$(STINFO06010_GRID_ID).jqGrid('setGridParam',{
677
+								postData:JSON.stringify(param)
678
+							}).trigger('reloadGrid');
679
+							$(this).find('.s-ico').show();
680
+							$(this).find('.ui-grid-ico-sort').hide();
681
+							$(this).find(icon).show();
682
+
683
+						}
684
+					});
649 685
 				},
650 686
 				onPaging: function(action) {
651 687
 					itp_fn_grid_paging(STINFO06010_GRID_ID, action, param);