<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ext</title>
<script type="text/javascript" src="ext-all.js"></script>
<link rel="stylesheet" href="css/ext-all.css">
<link rel="stylesheet" href="css/ext-all-gray.css">
<script type="text/javascript">
http://extjs-tutorials.blogspot.com/2011/11/store-filter-sort-group-php-yii.html
var idx = 0;

Ext.onReady(function () {
var store = Ext.create('Ext.data.Store', {
storeId: 'simpsonsStore',
fields: ['Name', 'Email', 'Phone'],
data: {
'items': [
{ 'Name': 'Lisa', "Email": "lisa@simpsons.com", "Phone": "555-111-1224" },
{ 'Name': 'Bart', "Email": "bart@simpsons.com", "Phone": "555-222-1234" },
{ 'Name': 'Homer', "Email": "home@simpsons.com", "Phone": "555-222-1244" },
{ 'Name': 'Marge', "Email": "marge@simpsons.com", "Phone": "555-222-1254" }
]
},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
});

var fieldsData = { "field": "Name", "type": "string" },
{ "field": "Email", "type": "string" },
{ "field": "Phone", "type": "string" }
;

helpWindow = showHelp({ uniqueID: 1, title: 'Select Customer', height: 400, width: 400, store: store, fieldsData: fieldsData });
// helpWindow = showHelp({ uniqueID: 2, title: 'Select Customer', height: 400, width: 400, store: store, fieldsData: fieldsData });
window.onresize = function () {
setLocation(helpWindow);
};

});

function setLocation(helpWindow) {
if (helpWindow) {
var body = document.body,
html = document.documentElement;
var browserHeight = Math.max(body.offsetHeight,
html.clientHeight, html.offsetHeight) - 5;
var browserWidth = Math.max(body.offsetWidth,
html.clientWidth, html.offsetWidth) - 5;
var windowWidth = helpWindow.width;
var windowHeight = helpWindow.height;

helpWindow.showAt(browserWidth - windowWidth, browserHeight - windowHeight);
}
};

function showHelp(config) {

config = config || {};
var uniqueID = config.uniqueID;
var store = config.store;
var fieldsData = config.fieldsData;

var windowWidth = config.width ? config.width : 400;
var windowHeight = config.height ? config.height : 400;
var title = config.title ? config.title : 'No Title yet';

var fields = Ext.create('Ext.data.Store', {
fields: ['field', 'type'],
data: fieldsData
});

var extWin = Ext.create('Ext.Window', {
title: title,
width: windowWidth,
height: windowHeight,
layout: 'fit',
uniqueID: uniqueID,
listeners: {
show: function (w) {
Ext.getCmp(w.uniqueID + 'fieldsCombo').setValue('Name');
}
},
items: Cannot resolve the wiki link macro, length of title is too long.,
store: store
}
]
}
]
});

setLocation(extWin);

return extWin;
}
</script>
</head>
<body>

</body>
</html>

Last edited Jan 7, 2013 at 9:11 PM by kirubasankars, version 1

Comments

No comments yet.