Javascript(216)
-
Sencha form에서 결과값 가져오기
failure: function(form, action) { let result = {}; try { result = Ext.decode(action.response.responseText); // Attempt JSON parsing } catch (e) { result.message = 'Invalid server response'; } console.log(result); Ext.Msg.alert('Failure', result.message || 'File upload failed.');}
2024.12.26 -
Sencha 파일 업로드
화면Ext.create('Ext.form.Panel', { title: 'File Upload Form', width: 400, bodyPadding: 10, renderTo: Ext.getBody(), // Render the form to the body frame: true, // Adds border and background items: [ { xtype: 'filefield', // File upload field name: 'file', // Name attribute for the uploaded file fieldLabel: 'Select File', labelWid..
2024.12.26 -
Sencha html 태그에서 변수 호출하기
Uncaught ReferenceError: a is not definedconst test = a;생략{ text: 'Image', dataIndex: 'image', renderer: function(value) { return '보기'; }}해결방법1: 변수를 global로 정의const test = a;window.a = a;해결방법2: 변수가 아닌 함수를 호출const test = a;function test() { alert(a);}생략{ text: 'Image', dataIndex: 'image', renderer: function(value) { return '보기'; }}
2024.12.25 -
Sencha grid column의 default값 설정
Model에 정의하기Ext.define('MyApp.model.MyModel', { extend: 'Ext.data.Model', fields: [ { name: 'name', type: 'string' }, { name: 'age', type: 'int', defaultValue: 25 }, // Default value { name: 'city', type: 'string', defaultValue: 'Unknown' } // Default value ]});Model 이벤트에 적용하기const store = Ext.create('Ext.data.Store', { fields: ['name', 'age', 'city'], data: [ ..
2024.12.25 -
Javascript arrya 데이터 삭제시 주의점
for문 등을 이용해서 삭제할 경우, 데이터가 밀리는 문제가 있음뒤에서부터 삭제를 해야 밀리는 문제가 없어짐잘못된 예const drawContainer = Ext.ComponentQuery.query('#drawContainer')[0];const surface = drawContainer.getSurface();const sprites = surface.getItems();console.log(sprites);displayedRects.splice(0, displayedRects.length);sprites.forEach(sprite => { if (sprite.type === 'rect') { console.log(sprite); surface.remove(sprite,..
2024.12.25 -
Sencha combobox 로딩시, 서버에서 값 가져오기
afterrender 이벤트 사용Ext.create('Ext.form.ComboBox', { fieldLabel: 'Select Item', queryMode: 'local', displayField: 'name', valueField: 'id', renderTo: Ext.getBody(), store: { fields: ['id', 'name'] // Define fields for the store }, listeners: { afterrender: function(combo) { // Trigger when ComboBox is rendered Ext.Ajax.request({ url:..
2024.12.24