08-10-2009 04:55 AM
<webscript>
<shortname>prova</shortname>
<description>Lists all documents with type: FATTURA ATTIVA</description>
<url>/marco/search</url>
<format default="json">extension</format>
<authentication>user</authentication>
<transaction>required</transaction>
</webscript>
{
total: ${total},
rows: [
<#list nodes as document>
{"id": "${document.nodeRef}", "name": "${document.name}"}
</#list>
]
}
var type='TYPE:"{http://www.marco.com/model/content/1.0}fatt_a"';
nodes = search.luceneSearch(type);
var start = 0;
var limit = 100;
if (args.start != undefined) {
start = args.start;
}
if (args.limit != undefined) {
limit = args.limit;
}
pagedResults = new Array();
for (i=0; i < nodes.length && i < limit; i++ ) {
var node = nodes[(+start + i)];
if (node != undefined) {
pagedResults.push(node);
}
}
model.nodes = pagedResults;
model.total = nodes.length;
Ext.onReady(function() {
var record = Ext.data.Record.create([ //definisco la forma del record
{id: 'id', name: 'name'},
]);
var myReader = new Ext.data.JsonReader({
totalProperty: "total", // numero righe
root: "rows", // lista dei dati da esporre (label del file json)
}, record);
var grid = new Ext.grid.GridPanel({
store: new Ext.data.Store({
// load using HTTP
proxy: new Ext.data.HttpProxy({url: 'http://localhost:8080/alfresco/service/opsoro/search'}), //effettuo al richiesta
reader: myReader //oggetto JSONreader
}),
columns: [
{header: 'ID', width: 120, sortable: true, dataIndex: 'id'},
{header: 'Name', width: 120, sortable: true, dataIndex: 'name'},
],
viewConfig: {
forceFit: true
},
renderTo: 'content',
title: 'mannaggia de la pulchiacchera!!!!',
width: 500,
height: 500,
frame: true
});
grid.getSelectionModel().selectFirstRow();
});
<html>
<head>
<title>Grid</title>
<!– Include Ext and app-specific scripts: –>
<script type="text/javascript" src="../adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../ext-all-debug.js"></script>
<script type="text/javascript" src="griglia.js"></script>
<!– Include Ext stylesheets here: –>
<link rel="stylesheet" type="text/css" href="../resources/css/ext-all.css">
<link rel="stylesheet" type="text/css" href="griglia.css">
</head>
<body>
<h1>Griglia dinamica</h1>
<div id="content">
</div>
</body>
</html>
08-10-2009 05:33 AM
<#escape x as jsonUtils.encodeJSONString(x)>
{
"total": ${total},
"rows": [
<#list nodes as document>
{"id": "${document.nodeRef}", "name": "${document.name}"}<#if document_has_next>,</#if>
</#list>
]
}
</#escape>
08-10-2009 06:45 AM
08-10-2009 07:48 AM
08-11-2009 10:55 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.