Javascript(216)
-
Sencha grid에 record 추가 후에 변경상태로 설정하기
record의 아무 셀이나 값을 변경하면, changed로 상태가 바뀜상태를 강제로 적용하려면, commit()을 호출success: function(response) { const data = Ext.decode(response.responseText); const store = gridImage.getStore(); store.loadData(data); if(draggedData) { // Add the dragged records to the store const addRecord = store.add(draggedData) addRecord.map(record => { const groupId = record.get(..
2025.01.26 -
Sencha drag and drop 적용시, 서버 호출로 인해서 객체가 초기화 되는 경우
별도의 변수를 설정하여 drag 객체 정보 보관객체가 사라지기 때문에 drop을 사용하면 에러가 남beforedrop을 통해서 작업하고, return을 false로 하면 drop이 수행 안됨viewConfig: { plugins: { ptype: 'treeviewdragdrop', ddGroup: ddGroup, enableDrop: true, }, listeners: { beforedrop: function (node, data, overModel, dropPosition, dropHandlers) { const treeNode = overModel; const gridRecords = data.r..
2025.01.26 -
Sencha 다른 component간의 drag and drop 적용
viewConfig에 plugins 적용 ddGroup으로 component간의 연결을 함 enableDrop과 enableDrag를 통해 drag와 drop을 허용할지 결정drag and drop의 이벤트는 viewConfig에 적용함const ddGroup = 'treeGridDDGroup';const treeStore = Ext.create('Ext.data.TreeStore', { fields: ['id', 'name', 'parent_id', 'leaf', 'attach_id'], root: { expanded: true, id: 0, },});const gridStore = Ext.create('Ext.data.Store', { fields: ['..
2025.01.26 -
Sencha view layout에서 controller 호출하기
app.view.controller 사용listeners: { change: function(combo, newValue, oldValue, eOpts) { app.view.controller.refresh(); }} change: function(combo, newValue, oldValue, eOpts) { const view = combo.up('panel'); // Adjust to the appropriate container const viewModel = view.getViewModel(); const controller = view.getController(); if (viewModel) { const skipInitialLoad =..
2025.01.25 -
Sencha callback 함수 null 처리 샘플
callback 함수sample: function (callback=null) { // Simulate namespace refresh logic const result = { success: true, data: 'Namespace data' }; console.log('Namespace refreshed.'); // Execute the callback with parameters if (typeof callback === 'function') { if(callback) { callback(result); } else { console.log(); } }}
2025.01.25 -
Sencha component와 ViewModel bind 이슈
bind가 ViewModel의 값을 업데이트하기 전에 change event가 실행되기 때문에 동기화 문제가 발생함해결방법1: 직접 업데이트listeners: { change: function(combo, newValue, oldValue, eOpts) { const vm = combo.up('panel').getViewModel(); // Adjust as needed for the correct container vm.set('searchParams.DATA', newValue); // Update the ViewModel directly app.view.controller.refresh(); }}해결방법2: 양방향으로 업데이트 설정bind: { ..
2025.01.25