Opened 15 years ago

Closed 15 years ago

#2522 closed defect (wontfix)

FilteringTable: cannot completely recreate widget metadata and data

Reported by: Dan Dascalescu Owned by: Tom Trenka
Priority: high Milestone: 1.0
Component: Widgets Version: 0.4.1
Keywords: Cc:
Blocked By: Blocking:


When a FilteringTable? is created from inside the "load" callback of a and populated with JSON data, there are 4 problems with the instantiated widget (code below):

  1. The data in the first JSON request populates the table OK, but the data in subsequent requests is shown in the table twice in each row: instead of (foo, bar, baz), the table displays (foo, bar, baz, foo, bar, baz).
  1. Calling clearData(), before setting up the columns and calling store.setData(), prevents the headers from displaying.
  1. Calling g.columns = [] after creating the widget and before setData() avoids the data duplication issue at 1., but this should not be necessary, since the widget is newly created and allegedly empty.
  1. Another issue I reproduced only with server-side code was that after the

second request, sorting by clicking table headers threw an exception "o has no properties".

Nabble link to e-mail thread for reference: The code is (highlighted) at and below.

Hope that helps, Dan Dascalescu

function populateTable(){{

url: '/translations/search?output=json',

/* JSON data returned by the server for every request: {

"columns" : {

"id" : "Number", "source" : "String", "language" : "String", "target" : "String",

}, "items" : [


"source" : "View Contacts", "target" : "Kontakte anzeigen", "language" : "de", "id" : 0

}, {

"source" : "%s's Contacts", "target" : "Kontakte von %s", "language" : "de", "id" : 1



} */

handler: function(type, data, evt) {

if(type == "load"){

var g = dojo.widget.createWidget(

"dojo:FilteringTable", {valueField: "id", alternateRows: true, multiple: true, maxSortable: 1}, dojo.byId("grid")

);; <-- BUG #1: column headers will never be rendered if this is called

g is created each time populateTable() is called, but the 2nd and subsequent calls to populateTable() show the set of columns duplicated, i.e. columns 1..4, 1..4 if the next line is commented g.columns = []; this prevents the issue above with the columns becoming duplicated after the first call for (var name in data.columns) {

g.columns.push(g.createMetaData({field: name, dataType: data.columns[name]}));


} else if(type == "error"){

alert("Error: " + data.message);

} else {

alert("Unkown handler type: " + type);


}, mimetype: "text/json", content: {

'q': dojo.byId('q').value,

}, changeURL: 'q=' + dojo.byId('q').value



<table valueField="id" class="grid" id="grid"></table>

Attachments (1)

Filtering_table_bugs.js (2.0 KB) - added by Dan Dascalescu 15 years ago.
Code snippet to reproduce FilteringTable? bugs

Download all attachments as: .zip

Change History (4)

Changed 15 years ago by Dan Dascalescu

Attachment: Filtering_table_bugs.js added

Code snippet to reproduce FilteringTable? bugs

comment:1 Changed 15 years ago by Tom Trenka

Component: GeneralWidgets

comment:2 Changed 15 years ago by Tom Trenka

Summary: Various issues with FilteringTables created in callback functionsFilteringTable: cannot completely recreate widget metadata and data

comment:3 Changed 15 years ago by bill

Resolution: wontfix
Status: newclosed

This is all being redone for the new Table widget, which operates via

Note: See TracTickets for help on using tickets.