我正在使用ExtJS4并寻找实现"转到顶部"功能的方法.
即在单击"顶部"按钮时,视图应滚动回到组件的顶部.我怎样才能在ExtJS中实现这一目标?
我在extjs工作.我正在创建显示grid.i的视图创建了视图 -
Ext.define('Balaee.view.qb.qbqns.allQuestionPapers' ,
{
extend: 'Ext.grid.Panel',
alias: 'widget.paperlist',
id:'paperId',
store:'QbqnsStore',
border:false,
height:300,
width:450,
columns: [
{
text: 'date',
width: 150,
dataIndex: 'creationTime'
},
{
text: 'QuestionpaperNo',
width: 150,
dataIndex: 'questionPaperNo',
},
{
text: 'Marks',
width:150,
dataIndex: 'obtainMarks'
}
]
});
Run Code Online (Sandbox Code Playgroud)
这个视图我正在调用getAllPapers按钮单击.所以我写了代码 -
getAllPapers:function()
{
var getPaperStore=Ext.create('Balaee.store.qb.QbqnsStore');
proxy=reviewQuestionStore.getProxy();
Ext.apply(proxy.api,{
read:'index.php/QuestionBank/qbpaper/getUserAllQuestionPaper',
});
var temp2=Ext.getCmp('QbqnsResultmainId');
temp2.removeAll();
var papers=Ext.create('Balaee.view.qb.qbqns.allQuestionPapers');
temp2.add(papers);
}
Run Code Online (Sandbox Code Playgroud)
在上面的函数中,我调用所需的URl来获取json -
{" Papers ":[{"questionPaperId":"29","questionPaperNo":"11","userId":"106","allocatedTime":null,"completedTime":"0000-00-00 00:00:00","createDate":"0000-00-00 00:00:00","obtainMarks":null},{"questionPaperId":"30","questionPaperNo":"11","userId":"106","allocatedTime":null,"completedTime":"0000-00-00 00:00:00","createDate":"0000-00-00 00:00:00","obtainMarks":null},{"questionPaperId":"31","questionPaperNo":"11","userId":"106","allocatedTime":null,"completedTime":"0000-00-00 00:00:00","createDate":"0000-00-00 00:00:00","obtainMarks":null}] }
Run Code Online (Sandbox Code Playgroud)
所以现在商店有上面的json数据,我想在网格上提供它.但是网格没有显示任何数据.那么如何将商店数据绑定到网格?我需要做些什么改变?
我正在研究extjs + php中的文件上传功能.我想从extjs上传文件或图像,需要将它发送到我在PHP设计的服务器端.在extjs中,我有查看文件的代码 -
Ext.define('Balaee.view.kp.dnycontent.Content',
{
extend:'Ext.panel.Panel',
requires:[
'Balaee.view.kp.dnycontent.ContentView'
],
id:'ContentId',
alias:'widget.Content',
title:'This day in a history',
items:[
{
xtype: 'fileuploadfield',
hideLabel: true,
emptyText: 'Select a file to upload...',
id: 'upfile',
//name:'file',
width: 220
}],
buttons:[
{
text: 'Upload',
handler: function () {
var file = Ext.getCmp('upfile').getEl().down('input[type=file]').dom.files[0]; console.log(file);
var reader = new FileReader();
filecontent=reader.readAsBinaryString(file);
console.log(filecontent);
}
}
]
Run Code Online (Sandbox Code Playgroud)
});
因此,当我尝试使用上面的代码上传animage文件.上面一行:
Ext.getCmp('upfile').getEl().down('input[type=file]').dom.files[0];将文件的信息存储为:
File {
webkitRelativePath: "",
lastModifiedDate: Tue Jul 14 2009 11:02:31 GMT+0530 (India Standard Time),
name: "Koala.jpg",
type: "image/jpeg", …Run Code Online (Sandbox Code Playgroud) 我正在研究Extjs4文件上传控件.我有文件上传控制视图 -
Ext.define('Balaee.view.kp.dnycontent.Content',
{
extend:'Ext.form.Panel',
requires:[
'Balaee.view.kp.dnycontent.ContentView'
],
id:'ContentId',
alias:'widget.Content',
enctype : 'multipart/form-data',
title:'This day in a history',
items:[
{
xtype: 'fileuploadfield',
hideLabel: true,
emptyText: 'Select a file to upload...',
//inputType: 'file',
id: 'upfile',
width: 220
}],
buttons: [{
xtype : 'button',
fieldlabel:'upload',
action:'upload',
name:'upload',
text: 'Upload',
formBind:'true'
}]
});
Run Code Online (Sandbox Code Playgroud)
控制器中的相应动作是 -
getUpload : function() {
var file10 = Ext.getCmp('ContentId').getEl().down('input[type=file]').dom.files[0];
var reader = new FileReader();
reader.onload = function(oFREvent) {
fileobj=oFREvent.target.result;
console.log(oFREvent.target.result);
};
}
});
Run Code Online (Sandbox Code Playgroud)
因此上面的控制器功能是重新上传文件并以编码格式显示在阅读器的onload功能中.即"console.log(oFREvent.target.result);" line在控制台中以编码格式显示上传文件的数据.我需要将此文件发送到服务器端.所以我传递fileobj作为参数存储as-
var storeObj=this.getStore('kp.DnycontentStore');
storeObj.load({
params:{ …Run Code Online (Sandbox Code Playgroud) 我在extjs4工作.我有代码组合框 -
{
margin:'7 6 5 5',
xtype:'combobox',
fieldLabel:'Language',
name:'language',
id:'combo',
width:190,
allowBlank:false,
emptyText: '--Select language--',
labelWidth: 60,
store: new Ext.data.ArrayStore({
fields: ['id','value'],
data: [
['1','Marathi'],
['2','English']
]
}),
queryMode: 'local',
valueField:'id',
displayField:'value',
editable:false
},
Run Code Online (Sandbox Code Playgroud)
根据我的功能,我想将combobox的值默认设置为用户选择的选项.那么如何从控制器中设置组合框的值
我在extjs工作.我有gridview与grid cellediting插件as-
Ext.define('H.view.library.LibraryListView', {
extend: 'Ext.grid.Panel',
alias : 'widget.librarylistview',
id:'librarylistviewId',
store: 'LibraryFileStore',
requires:['RUI.view.campaign.ImageViewer'],
plugins:[
Ext.create('Ext.grid.plugin.CellEditing',{
clicksToEdit: 1,
listeners: {
'edit': function(editor,e) {
var me=this;
title = e.value;
id = e.record.get('id');
}
}
})
],
Run Code Online (Sandbox Code Playgroud)
我想在status = 0时禁用此编辑.那么根据条件,我需要做些什么来禁用和启用cellediting
我在 extjs4 中工作。我有 ganttChart 视图。我想更改 treecolumn 和 gantt 之间的分隔线的颜色。我正在创建甘特图 =
var gantt = Ext.create("Gnt.panel.Gantt", {
itemId :'project-list-gantt-chart',
cls : 'projectlistganttchart',
enableTaskDragDrop: false,
columnLines :true,
lockedGridConfig :{
split: false
},
viewPreset : 'customPreset',
columns : [{
xtype : 'treecolumn',
sortable: true,
dataIndex: 'Name',
}],
Run Code Online (Sandbox Code Playgroud)
我在下面的表单面板中包含了这个甘特图=
Ext.define('GanttChart' ,{
extend: 'Ext.form.Panel',
border: false,
})
Run Code Online (Sandbox Code Playgroud)
通过使用面板的 add 方法,我将它包含为 - afterrender : function(){ var me = this; 我.添加(甘特图);}
所以为了改变颜色,我将 css 更改为-
.x-panel-default{
border-color: red;
padding: 0;
}
Run Code Online (Sandbox Code Playgroud)
但是我的项目中所有面板的颜色都会发生变化。那么如何覆盖这个 css 以便它只改变甘特图的颜色。