1){QueryDialog=true;}
if(objStore.getCount()==0){QueryDialog=true;}
if(QueryDialog){
this.OpenSearch();
return false;
}
this.eventDone(objStore.getAt(0),this.Scope);
return true;
}
};
this.storeSearch.on('datachanged', this.eventStoreSearchDataChanged, this);
this.pagingSearch = new Ext.PagingToolbar({
store: this.storeSearch, pageSize: this.varRecordLimit
, displayInfo: true
, displayMsg: 'Menampilkan data: {0} - {1}. Total: {2}'
, emptyMsg: 'Tidak ada data.'
});
this.gridSearch = new Ext.grid.GridPanel({
store: this.storeSearch
, columns: this.StructGridCollumn
, view: new Ext.grid.GroupingView({
forceFit: false
, groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'
})
, sm: new Ext.grid.RowSelectionModel({singleSelect:true})
, stripeRows: true
, frame: true
// , autoExpandColumn: 'alamat'
, autoScroll: true
, tbar: ['Kata kunci Pencarian :', ' ', this.txtSearch /* ,'->' , 'Filter' , this.cbSearchFilter */ ]
, bbar: this.pagingSearch
, listeners: {
keydown: function(e){
this.gridKeyPress(e);
}, scope: this
}
});
this.eventGridSearchRowDblClick = function(objGrid, rowindex, e){
if(this.CallbackQueryDone){
this.doSelect();
}
return true;
};
this.gridSearch.on('rowdblclick', this.eventGridSearchRowDblClick, this);
this.gridKeyPress=function(e){
var key=e.getKey();
if(key==vk_RETURN) {
e.preventDefault(); e.stopPropagation();
this.doSelect();
return true;
} else if(key==vk_UP) {
e.preventDefault(); e.stopPropagation();
this.selectPrevious(true);
return true;
} else if(key==vk_DOWN) {
e.preventDefault(); e.stopPropagation();
this.selectNext(true);
return true;
} else if(key==vk_PgUP) {
e.preventDefault(); e.stopPropagation();
this.previousPage(true);
return true;
} else if(key==vk_PgDOWN) {
e.preventDefault(); e.stopPropagation();
this.nextPage(true);
return true;
} else if(key==vk_F8) {
this.SelectedIndex = this.getSelectedIndex();
if(this.SelectedIndex!=-1){
var row = this.SelectedIndex; var collumn = 8;
// alert( [ row , collumn ]);
cell = this.gridSearch.getView().getCell(row,collumn);
var position = cell.getXY();
// var position = Ext.fly( this.gridSearch.getView().getCell(row,collumn) ).getXY();
// position[0] += -25; // X
// position[1] += 1; // Y
console.log(position);
this.gridFloatingMenu.showAt( position );
// return true;
// alert('ok');
return true;
}
}
return true;
};
// ====================================================================================
// ====================================================================================
this.doSelection = function() {
this.Selected = null;
try {
this.Selected = this.gridSearch.getSelectionModel().getSelected();
}
catch(err) {
// catchCode - Block of code to handle errors
}
finally {
if(this.Selected) {
if(this.Selected.get('State')=='0'){
return true;
}
return true;
}
}
}
this.ActionDetail1Event = function(){
// alert('1');
try {
this.Selected = this.gridSearch.getSelectionModel().getSelected();
}
catch(err) {
// catchCode - Block of code to handle errors
}
finally {
if(this.Selected) {
if(this.Selected.get('State')=='0'){
return true;
}
return true;
}
}
}
this.ActionDetail1 = new Ext.Action({
text: 'Detail1'
, style: '{background-image: url(__VIRTUAL_DIRECTORY____SUBDIRECTORY__/assets/user/images/new-doc-22X22.png); background-repeat:no-repeat;}'
, iconCls: 'blist'
});
this.ActionDetail1.setHandler(this.ActionDetail1Event, this);
this.ActionDetail2Event = function(){
// alert('2');
try {
this.Selected = this.gridSearch.getSelectionModel().getSelected();
}
catch(err) {
// catchCode - Block of code to handle errors
}
finally {
if(this.Selected) {
if(this.Selected.get('State')=='0'){
return true;
}
return true;
}
}
}
this.ActionDetail2 = new Ext.Action({
text: 'Detail2'
, style: '{background-image: url(__VIRTUAL_DIRECTORY____SUBDIRECTORY__/assets/user/images/save-doc-22X22.png); background-repeat:no-repeat;}'
, iconCls: 'blist'
});
this.ActionDetail2.setHandler(this.ActionDetail2Event, this);
this.gridFloatingMenu = new Ext.menu.Menu({
floating: true
, style: '{border-radius: 3px;}'
, items: [
this.ActionDetail1
, this.ActionDetail2
]
});
// ====================================================================================
// ====================================================================================
this.eventGridSearchCellClick = function(objGrid, row, collumn, event){
if(objGrid.getColumnModel().getDataIndex(collumn)=='doSelect'){
this.doSelect();
return true;
}
if(objGrid.getColumnModel().getDataIndex(collumn)=='menu'){
var htmlCell = objGrid.getView().getCell(row, collumn);
var cell = Ext.fly(htmlCell);
var position = cell.getXY();
// var position = Ext.fly( objGrid.getView().getCell(row,collumn) ).getXY();
position[0] += -25; // X
position[1] += 1; // Y
// console.log(position);
this.gridFloatingMenu.showAt( position );
return true;
}
};
this.gridSearch.on('cellclick', this.eventGridSearchCellClick, this);
// ====================================================================================
// ====================================================================================
this.doSelect = function() {
try {
var Selected = this.gridSearch.getSelectionModel().getSelected();
}
catch(err) {
// catchCode - Block of code to handle errors
}
finally {
if(Selected) {
if(Selected.get('State')=='0'){
this.strMessage =
'' +
'
' +
'
Perawatan Penderita Sudah Selesai ' +
'
Tidak diperkenankan Transaksi Depo ' +
'
' +
'
'
;
this.alertMessage.callbackClose = function(){
this.txtSearch.focus();
};
this.alertMessage.scope = this;
this.alertMessage.setPosition(280,180);
this.alertMessage.message('Peringatan', 300, 200, this.strMessage);
return true;
}
this.varModalResult=true;
this.eventDone(Selected);
this.window.hide();
return true;
}
}
};
this.eventWindowListener = function(c) {
c.getEl().on(strKeyEvent, function(e){
var key=e.getKey();
if(key==vk_TAB){
e.preventDefault(); e.stopPropagation();
return true;
};
return true;
}, this);
};
this.window = new Ext.Window({
layout: 'fit'
, pageX: 30, pageY: 30, width: 600, height: 380
, constrain: false
, closeAction: 'hide'
, modal: true
, resizable: true
, plain: true
, items: [this.gridSearch]
});
this.window.addListener('render', this.eventWindowListener, this);
// this.window.show(); this.window.hide(); // untuk reset bug pada browser;
// public Inisialisasi //
this.windowId=this.window.getId();
this.varWindowChange=false;
this.Url=strUrl;
if(strUrl&&this.Url!=strUrl){this.varWindowChange=true;this.Url=strUrl;}
if(strTitle&&this.title!=strTitle){this.varWindowChange=true;this.title=strTitle;}
if(left&&this.varLeft!=left){this.varWindowChange=true;this.varLeft=left;}
if(top&&this.varTop!=top){this.varWindowChange=true;this.varTop=top;}
if(width&&this.varWidth!=width){this.varWindowChange=true;this.varWidth=width;}
if(height&&this.varHeight!=height){this.varWindowChange=true;this.varHeight=height;}
if(this.varWindowChange){
this.window.setTitle(strTitle);
this.window.setPagePosition(this.varLeft,this.varTop);
this.window.setWidth(width);
this.window.setHeight(height);
}
if(CallbackQueryDone){this.CallbackQueryDone=CallbackQueryDone;}
if(CallbackQuerySkip){this.CallbackQuerySkip=CallbackQuerySkip;}
if(Scope){this.Scope=Scope;}
this.eventShowWindow=function(e){
Ext.fly(this.txtSearchId).focus(500);
};
this.window.on('show', this.eventShowWindow, this);
this.eventHideWindow=function(e){
if(!this.varModalResult){this.eventSkip();}
};
this.window.on('hide', this.eventHideWindow, this);
this.reQuery = function(objStore){
if(!objStore){ objStore=this.storeSearch; }
objStore.setBaseParam('page_id', strPageId);
objStore.setBaseParam('dataset', this.varDataset);
objStore.setBaseParam('state', 'request_data');
objStore.setBaseParam('bl_state', this.strBlState);
objStore.setBaseParam('filter_operation', this.cbSearchFilter.getValue());
objStore.setBaseParam('filter_request_date', this.strFilterRequestDate);
objStore.setBaseParam('filter_competence_code', this.strFilterCompetenceCode);
/*
objStore.setBaseParam('filter_menu_id', this.strFilterMenuId);
objStore.setBaseParam('filter_department_id', this.strFilterDepartmentId);
objStore.setBaseParam('filter_string', this.strFilterString);
*/
objStore.setBaseParam('search', this.txtSearch.getValue());
objStore.load({params:{start:0, limit:this.varRecordLimit}});
};
this.OpenSearch = function(){
this.txtSearch.setValue(this.strSearch);
this.SelectedIndex=0;
this.windowState=true;
this.reQuery(this.storeSearch);
this.window.show();
};
// public function //
this.search = function(strSearch,RecordLimit){
this.varModalResult=false; this.strSearch=strSearch; this.txtSearch.setValue(this.strSearch);
if(RecordLimit&&this.varRecordLimit!=RecordLimit){
this.pagingSearch.pageSize=RecordLimit;
this.varRecordLimit=RecordLimit;
}
this.windowState = false ;
// this.cbSearchFilter.setValue('ALL');
this.reQuery(this.StoreSearch);
};
this.open = function(strSearch,RecordLimit){
this.varModalResult=false; this.strSearch=strSearch; this.txtSearch.setValue(this.strSearch);
if(RecordLimit){
this.pagingSearch.pageSize=RecordLimit;
this.varRecordLimit=RecordLimit;
}
// this.cbSearchFilter.setValue('ALL');
this.OpenSearch();
return true;
};
}
if(!objSearchPatientNursing){
var objSearchPatientNursing = new ClassSearchPatientNursing('','Daftar Penderita',195,75,980,500,null,null,this);
} else {
objSearchPatientNursing = new ClassSearchPatientNursing('','Daftar Penderita',195,75,980,500,null,null,this);
}