about the code completion

Get help with Spket IDE.
Post Reply
sunanan
Posts: 4
Joined: Sun Apr 20, 2008 2:19 pm

about the code completion

Post by sunanan » Sun Apr 20, 2008 2:35 pm

I use the aptanastudio with spket 1.6.11

but ... see the example:

Ext.onReady(function(){

// Note: For the purposes of following along with the tutorial, all
// new code should be placed inside this method. Delete the following
// line after you have verified that Ext is installed correctly.

//01//alert("Congratulations! You have Ext configured correctly!");
var myDiv = Ext.get('myDiv');
myDiv.highlight(); //黄色高亮显示然后渐退
myDiv.addClass('red'); // 添加自定义CSS类 (在ExtStart.css定义)
myDiv.center(); //在视图中将元素居中
myDiv.setOpacity(.25); // 使元素半透明
Ext.select('p').highlight();

Ext.get('myButton').on('click', function(){
alert("你单击了按钮");
});

// Ext.select('p').on('click', function() {
// alert("你单击了一段落;");
// });

// var paragraphClicked = function() {
// alert("你单击了一段落_ object;");
// }
// Ext.select('p').on('click', paragraphClicked);

// var paragraphClicked = function(e) {
// Ext.get(e.target).highlight();
// }
// Ext.select('p').on('click', paragraphClicked);

var paragraphClicked = function(e){
var paragraph = Ext.get(e.target);
paragraph.highlight();
Ext.MessageBox.show({
title: 'Paragraph Clicked',
msg: paragraph.dom.innerHTML,
width: 400,
buttons: Ext.MessageBox.OK,
animEl: paragraph
});
}
Ext.select('p').on('click', paragraphClicked);
/////////////////////////////////////////////////////////////////////////
var myData = [['Apple', 29.89, 0.24, 0.81, '9/1 12:00am'], ['Ext', 83.81, 0.28, 0.34, '9/12 12:00am'], ['Google', 71.72, 0.02, 0.03, '10/1 12:00am'], ['Microsoft', 52.55, 0.01, 0.02, '7/4 12:00am'], ['Yahoo!', 29.01, 0.42, 1.47, '5/22 12:00am']];

var myReader = new Ext.data.ArrayReader({}, [{
name: 'company'
}, {
name: 'price',
type: 'float'
}, {
name: 'change',
type: 'float'
}, {
name: 'pctChange',
type: 'float'
}, {
name: 'lastChange',
type: 'date',
dateFormat: 'n/j h:ia'
}]);

var grid = new Ext.grid.GridPanel({
store: new Ext.data.Store({
data: myData,
reader: myReader
}),
columns: [{
header: "Company",
width: 120,
sortable: true,
dataIndex: 'company'
}, {
header: "Price",
width: 90,
sortable: true,
dataIndex: 'price'
}, {
header: "Change",
width: 90,
sortable: true,
dataIndex: 'change'
}, {
header: "% Change",
width: 90,
sortable: true,
dataIndex: 'pctChange'
}, {
header: "Last Updated",
width: 120,
sortable: true,
renderer: Ext.util.Format.dateRenderer('m/d/Y'),
dataIndex: 'lastChange'
}],
viewConfig: {
forceFit: true
},
renderTo: 'content',
title: 'My First Grid',
width: 500,
frame: true
});

grid.getSelectionModel().selectFirstRow();//final


});

I input the code (red's),
Ext.select('p').
after the red point, I can not get the highlight() property.
I need to type the property manually.

Last line is also so .

eric_suen
Site Admin
Posts: 678
Joined: Wed Sep 28, 2005 7:00 am
Contact:

Post by eric_suen » Mon Apr 21, 2008 1:36 am

Hi, these are the Ext Document issue, the first one: Ext.select = Ext.Element.select, the JSDoc is for Ext.select, actually Ext.Element.select should be documented, but this issue can be fixed in Spket, I will fix this one in next version.

The second one is because it return wrong type, @return {SelectionModel}, but there is no SelectionModel, actually it should be RowSelectionModel which super class is AbstractSelectionModel -> Observable

sunanan
Posts: 4
Joined: Sun Apr 20, 2008 2:19 pm

thanks, but....

Post by sunanan » Fri May 09, 2008 1:12 am

thanks, i see you solve my problem in the CHANGES.

but. in the code
Ext.select('p').highlight();
when I type the point after the "('p')", i can not see the highlight() code assist.

so..., please help me solve the problem again. thanks!!!

eric_suen
Site Admin
Posts: 678
Joined: Wed Sep 28, 2005 7:00 am
Contact:

Post by eric_suen » Fri May 09, 2008 3:51 am

Hmm, Ext.select returns {CompositeElementLite/CompositeElement}, I don't think these object has highlight method.

eric_suen
Site Admin
Posts: 678
Joined: Wed Sep 28, 2005 7:00 am
Contact:

Post by eric_suen » Fri May 09, 2008 4:12 am

If you really want see highlight() in code assist, move the cursor to select method, the press F3, in "CompositeElement.js" file, add following code

Code: Select all

Ext.applyIf(Ext.CompositeElement.prototype, Ext.Element.prototype);
after Ext.select = Ext.Element.select;, save the file, then reload the JavaScript Profile via Ctrl+Shift+F5

sunanan
Posts: 4
Joined: Sun Apr 20, 2008 2:19 pm

Post by sunanan » Fri May 09, 2008 5:58 am

I try it.
================

I have tried it. thank you.

but, I use, Ext.select('p').highlight(),

I get the <p></p>,and apply the highlight effect .
through the highlight() method belongs to Fx.
but As element effect , the method should be display.

eric_suen
Site Admin
Posts: 678
Joined: Wed Sep 28, 2005 7:00 am
Contact:

Post by eric_suen » Fri May 09, 2008 7:16 am

You can find following code in "CompositeElement.js",

Code: Select all

(function(){
...
for(var fnName in Ext.Element.prototype){
    if(typeof Ext.Element.prototype[fnName] == "function"){
        Ext.CompositeElement.createCall(Ext.CompositeElement.prototype, fnName);
    }
};
})();
, Spket does not support this kind of syntax, to help the code assist, you can add

Code: Select all

Ext.applyIf(Ext.CompositeElement.prototype, Ext.Element.prototype);
to achieve that, but you should not using that code in runtime

A better way is not modify "CompositeElement.js" directly, you can create a file helper.js, and add code

Code: Select all

Ext.applyIf(Ext.CompositeElement.prototype, Ext.Element.prototype);
in that file, than add that file to your JavaScript profile, just make sure the helper.js should after the ext.jsb

sunanan
Posts: 4
Joined: Sun Apr 20, 2008 2:19 pm

Post by sunanan » Fri May 09, 2008 7:29 am

thanks a lot,
i get a right way to study extjs. thanks again.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests