- var $plugindiv = this.elmt();
- var options = this.options;
- // locate the <table> element; with datatables in the way,
- // this might not be a direct son of the div-plugin
- var $table = $plugindiv.find("table."+this.classname).first();
- // also we may or may not have a header
- var $tbody = $table.find("tbody."+this.classname).first();
- var use_datatables = $table.hasClass("with-datatables");
+ var $plugindiv = this.elmt();
+ var options = this.options;
+ // locate the <table> element; with datatables in the way,
+ // this might not be a direct son of the div-plugin
+ var $table = $plugindiv.find("table."+this.classname).first();
+ // also we may or may not have a header
+ var $tbody = $table.find("tbody."+this.classname).first();
+ var use_datatables = $table.hasClass("with-datatables");
- if (debug)
- messages.debug($plugindiv.attr('id') + " udt= " + use_datatables + " rows="+rows.length);
-
- if (rows.length == 0) {
- if (use_datatables)
- this._datatables_set_message ($table, $tbody, unfold.warning("No result"));
- else
+ if (debug){
+ messages.debug($plugindiv.attr('id') + " udt= " + use_datatables + " rows="+rows.length);
+ }
+ // check if rows contains results related to the object key
+ object_key = this.options.key.split('.');
+ if (rows.length == 0 || rows[0][object_key[0]].length == 0) {
+ if (use_datatables){
+ this._datatables_set_message ($table, $tbody, unfold.warning("No result"));
+ }else{
- if (typeof rows[0].error != 'undefined') {
- var error="ERROR: " + rows[0].error;
- if (use_datatables)
- this._datatables_set_message ($table, $tbody, unfold.error(error));
- else
+ if (typeof rows[0].error != 'undefined') {
+ var error="ERROR: " + rows[0].error;
+ if (use_datatables){
+ this._datatables_set_message ($table, $tbody, unfold.error(error));
+ }else{
- if (use_datatables)
- this._datatables_update_table($table, $tbody, rows, options.key);
- else
- this._regular_update_table($table, $tbody, rows, options.key, this.classname);
+ if (use_datatables){
+ this._datatables_update_table($table, $tbody, rows, options.key);
+ }else{
+ this._regular_update_table($table, $tbody, rows, options.key, this.classname);
+ }