PDA

View Full Version : Extending an object (the other way?)



dimebag
25 Mar 2010, 9:17 AM
Hi,

is it a common way to extend an class by doing this via the configuration-object?
I was wondering that this is working:



<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>

<link rel="stylesheet" type="text/css" href="js/extjs/resources/css/ext-all.css" />
<script type="text/javascript" src="js/extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="js/extjs/ext-all.js"></script>

<script type="text/javascript">
Ext.onReady(function(){

var panel = new Ext.Panel({

renderTo: document.body,
title: 'Extending the other way',
width: 300,
height: 300,
dummy1: 'My Name',
dummy2: function() {

alert (this.dummy1);
}
});

panel.dummy2();
});

</script>

</head>

<body>

</body>
</html>

evant
25 Mar 2010, 9:22 AM
You're not really extending it, in that case, you're just adding methods onto a particular instance.