blob: 91f3b3d7d59707540a707f12222beeb9423f4621 [file]
#summary Details about the new Lists protocol
#labels Importance-Useful,Phase-Implementation,Contents-Draft
= Introduction =
In this page you can find details about the new lists protocol, made to solve Issue201.
= Protocol format =
The JSON expected should have the following general format (see Details):
{{{
{
"configuration" : {},
"operations" : {
"buttons": [
{
"bounds": [],
"id": "",
"caption": "",
"type": "",
"parameters": {}
}
],
"row": {
"type": "",
"parameters": {}
}
},
"data": {
"": [
{
"columns": {}
"operations": {
"buttons": {
"": {
}
}
"row": {}
}
}
]
}
}
}}}
= Details =
This is a step by step description of the protocol.
The very general format is a JSON object with three different objects, indexed by keys, with the following format:
{{{
{
"configuration" : {},
"operations": {},
"data": {}
}
}}}
----
== *configuration* ==
The _configuration_ object is passed *verbatim* to [http://www.trirand.com/blog/ JQGrid], which is the jQuery plugin that is used by Melange to show lists. In this way, it's the Python end that decides every aspect of the appearance of the list. All the informations about the configuration object can be found in [http://www.trirand.com/jqgridwiki/doku.php?id=wiki:jqgriddocs JQGrid Wiki pages], pages concerned are [http://www.trirand.com/jqgridwiki/doku.php?id=wiki:conventions conventions], [http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options options] and [http://www.trirand.com/jqgridwiki/doku.php?id=wiki:colmodel_options colmodel]. However here is a brief example explained:
{{{
"configuration": {
"colNames": ["Key", "Link ID", "Name", "Program Owner"],
"colModel": [
{name: "key", index: "key", resizable: true},
{name: "link_id", index: "link_id", resizable: true},
{name: "name", index: "name", resizable: true},
{name: "program_owner", index: "program_owner", resizable: true}
],
rowNum: 4,
rowList: [4, 8],
autowidth: true,
sortname: "link_id",
sortorder: "asc",
toolbar: [true, "top"]
}
}}}
* *colNames*: is an *array of strings* which defines the label of each column as shown to the end user.
* *colModel*: is an *array of objects*, which defines more details about each column. The number of objects in the array should be the same as the number of strings in the _colNames_ array. The order of the columns detailed in the _colModel_ array should be the same of what's in the _colNames_ array. In this example, each object of the _colModel_ has a *name*, which should be the same name as defined in the "data - columns" object of the protocol. The *index* string (normally same as _name_ string) defines which is the column that is used to order the whole list when clicking on the column. *resizable* is a simple boolean field, which determines if the column of the final list is resizable or not.
* *rowNum*: is an *integer*, and defines a default of how many rows should be shown for each page of the list
* *rowList*: is an *array of integers*, which defines a list of choices to the end user of number of elements to be displayed for each page. In this case, the end user can choose to display 4 or 8 elements for each page of the list.
* *autowidth*: is a *boolean*, which defines if the width of the list should be dinamically changed to fill the whole page.
* *sortname*: is a *string* that defines which is the default order of the list (should be one of the _name_ string in the _colModel_ array of objects.
* *sortorder*: should be a *string* chosen from _asc_ and _desc_, to define the default order of the list.
* *toolbar*: is an *array of a boolean and a string*. This should be present as displayed in the example if there are buttons to be displayed on top of the list (for example to show add/edit/delete options, see _data/operations/buttons_ details and _operations/buttons_ details.
----
== *operations* ==
----
== *data* ==