我正在尝试理解我编辑的代码。
所以我创建了以下变量 var headerPlaceHolderComponent ='()';
并将其放在下面的函数中
formatTitle: function (containerWidth, containerNameTitle, aggregationTitle) {
// one character approximates to 6 pixels. So, dividing by 5.5
var maxCharacters = Math.ceil(containerWidth / 5.5);
var combinedTitle = containerNameTitle + aggregationTitle;
if (combinedTitle.length > maxCharacters) {
var numberOfCharsToTruncate = maxCharacters - combinedTitle.length;
aggregationTitle = aggregationTitle.replace(aggregationTitle.slice(numberOfCharsToTruncate), '...');
}
var formattedContainerNameTitle = '<span class="conatiner-name-title">' + containerNameTitle + '</span>';
var formattedAggregationTitle = '(<span class="aggregation-title-style-in-grid">' + aggregationTitle + '</span>)';
var headerPlaceHolderComponent = '(<span class="header-placeholder"></span>)';
var formattedCombinedTitle = aggregationTitle.length > 0 ? formattedContainerNameTitle + ' ' + formattedAggregationTitle + headerPlaceHolderComponent
: formattedContainerNameTitle + headerPlaceHolderComponent ;
return formattedCombinedTitle;
},
目前,我创建的Span在以下范围内以HTML格式呈现。
<span class="x-panel-header-text x-panel-header-text-default-framed" id="ext-gen1419">
<span id="ext-gen1525" class="header-placeholder"></span> <!--My Span -->
</span>
我希望我的跨度在此div中呈现:
所以我的最终渲染编码将如下所示:
<div class="x-component x-box-item x-component-default" id="component-1196" role="heading">
<span id="ext-gen1525" class="header-placeholder"></span> <!--My Span -->
</div>
如何指定我的范围将在HTML中呈现的位置?