当列被冻结时onClick不工作

时间:2017-08-31 04:05:06

标签: javascript jquery

考虑代码:

localStorage.setItem(gridNameForUDF + ' - frozen columns', '2');
jq(document).ready(function() {

    var VFPAGE = '  TestPage';
    var currentLocation = window.location.href;
    var newLocation = currentLocation.replace('gblite.','c.');
    newLocation = newLocation.substring(0, newLocation.indexOf('Grid?')) + VFPAGE;
    var gridInfo = getGridInfoByName('p');  
    var priceBookEntryIdMetaCol;
    //console.log('VFPAGE '+VFPAGE);
    for (var i=0; i<gridInfo.metaColumns.length; i++) {
        var thisCol = gridInfo.metaColumns[i];

        if (thisCol.fieldName == '****') {
            **** = thisCol;

            break;
        }
    }
    var dataRows = jq('table#gbMainTable > tbody > tr.dr');
    dataRows.find('td[name="' + ****.fieldId + '"]').each(function() {

        var cell = jq(this);
        var recordId = cell.closest('tr').attr('id');

        console.log('====cell====',cell.find('td').find('span'));
        cell.on('click', function(e) { 
            console.log('=======cell=====');
            e.stopPropagation(); 

            window.open(newLocation + '?oliId=' + recordId, '_blank');
        });
    });
});

在顶部我在localstorage中设置一些值来设置网格冻结的前两列。 然后在单元格上注册onclick事件。 现在发生的事情是,onlclick注册得很好,但是在js完全加载了类名后,如果单元格变为“ui-selectee none&#39;好像我删除了冻结的列代码localStorage.setItem(gridNameForUDF + ' - frozen columns', '2');,然后类名是&#39; ui-selectee&#39;。 因此,点击单元格不起作用。 包括冻结列会创建另一个div组件。

有解决方案吗? 我不能使用getElementById,我也无法删除冻结的列代码。

0 个答案:

没有答案