Additional Blogs by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

There was following code in function _updateTableContent, defined in file Table.js:


if(r.getBindingContext()&&this._isRowSelectable(r.getIndex())){
$.rowSelector.attr('title',this._oResBundle.getText('TBL_ROW_SELECT'));}else{$.rowSelector.attr('title','');
}






In this code Object $ with property rowSelector is returned by function getDomRefs, defined in file Row.js, and there is following block in this function:


if (d.rowSelector && d.rowSelector.length > 0) {
d.row = d.row.add(d.rowSelector);
} else {
d.rowSelector = undefined;
}  






In this block property rowSelector is forcibly set as undefined, when (d.rowSelector && d.rowSelector.length > 0) is false.

But there may be the case, when d.rowSelector was not undefined and not an array, which length may be greater than 0, but the object, which has two own properties named "context" and "selector".

And if this property may and is forcibly set to undefined (in Row.js), then it must be checked before calling some function of this property.

Because, if there is no such checks, then following error might and appeared in console:

Cannot read property 'attr' of undefined.

Therefore following code in file sap/ui/table/Table.js (without mentioned checks):


if(r.getBindingContext()&&this._isRowSelectable(r.getIndex())){
$.rowSelector.attr('title',this._oResBundle.getText('TBL_ROW_SELECT'));
}else{
$.rowSelector.attr('title','');
}






should be changed to following code (with mentioned checks):


if($.rowSelector){
if(r.getBindingContext()&&this._isRowSelectable(r.getIndex())){
$.rowSelector.attr('title',this._oResBundle.getText('TBL_ROW_SELECT'));
}else{
$.rowSelector.attr('title','');
}
}






This was the reason, why I asked community to show me the way, how this change can be done: Please, help to fix error in Table.js.

chandrashekhar.mahajan kindly specified to me the following url, where is written how to report bug in OPENUI5:

http://openui5.org/bugreports.html

where I found url for submitting issue in OPENUI5:

https://github.com/SAP/openui5/issues/new

However, when I started to search the issue tracker to make sure the bug has not yet been reported:

https://github.com/SAP/openui5/commits/master/src/sap.ui.table/src/sap/ui/table/Table.js

then I have found out, that there is no definition of erroneous function _updateTableContent in the latest version of file Table.js

(b0e03a: @SebastianRied SebastianRied Merge "[FIX] sap.ui.table.Table: refreshRows getting called without b…)

https://github.com/SAP/openui5/blob/9b0e03a4771e3dc103951afc15e6465fffcd6e50/src/sap.ui.table/src/sa...

Then I checked the version of this file, which was created a half-year ago - on Nov 24, 2015

(be2700a: @SebastianRied SebastianRied [FIX] sap.ui.table.Table: fixes display issue with MultiLabels and fi…)

https://github.com/SAP/openui5/blob/be2700acd2ed5d9981b1c84f57ccf1911d9565a0/src/sap.ui.table/src/sa...

and there in line 771 I found definition of erroneous function:


Table.prototype._updateTableContent = function() {


and in line 797 I found erroneous statement:


$rowDomRefs.rowSelector.attr("title", this._oResBundle.getText("TBL_ROW_SELECT"));


Then on more recent page of version list I checked the version, which was created on Feb 23, 2016

(abf2f5c: @SebastianRied SebastianRied [FEATURE] sap.ui.table: Performance improvements for table library)

https://github.com/SAP/openui5/blob/abf2f5c49b811d4a8d86d6bbdd4cc0a306cc2c4a/src/sap.ui.table/src/sa...

and there again was no definition of erroneous function.

After further search between versions Nov 24, 2015 and Feb 23, 2016 following interesting facts were discovered:

1) in version, which was created Jan 28, 2016

(86fd37f: @SebastianRied SebastianRied Merge "[FIX] sap.ui.table.Table: fixes null-ref issue with rowSelecto…)

https://github.com/SAP/openui5/blob/86fd37f5fa33b8448d46617e046156063a276272/src/sap.ui.table/src/sa...

abovementioned change (for fixing error in Table.js) was already done (as it stated in title), however

2) in version, which was created on Feb 1

(80fa0f1: @SebastianRied SebastianRied [INTERNAL] sap.ui.table.Table: Revert Layout Thrashing Change)

https://github.com/SAP/openui5/blob/80fa0f18017a65700e94bc0c628cd5b925200bfe/src/sap.ui.table/src/sa...

this change was reverted, and at last

3) in the same version, which was already mentioned above and which was created on Feb 23, 2016

(abf2f5c: @SebastianRied SebastianRied [FEATURE] sap.ui.table: Performance improvements for table library)

https://github.com/SAP/openui5/blob/abf2f5c49b811d4a8d86d6bbdd4cc0a306cc2c4a/src/sap.ui.table/src/sa...

block, where function attr of property rowSelector was called, was removed at all and thus error was fixed!