Xpages, Bootstrap and Data Views

2019-08-27 08:06发布

问题:

I have a Data View in an Xpage application which is using the Bootstrap theme. I started to use a View, but could never get the pagers lines up, and the data view is working better.

But I do not understand where to put my table class css. For example, if I want a stripped table I enter "table table-striped" in the styleClass of the view (or maybe it is the dataStyleClass). If I do that in the styleClass of the data view, I do not get strips.

I tried the suggestion from Mark below, but something is not working. I added a script call and used the id of the tableview. It already has a class of "cleearfix table" on it.

I have added Chrome's web inspector to show what is going on.

回答1:

The xe:dataView control does have a styleClass attribute, but classes that you set there are added to the div element that wraps the dataview, not the table (and that's where Bootstrap needs the table-striped class. I would solve this with some JavaScript to add the classes you need on the table element

<xp:scriptBlock
id="scriptBlock1">
  <xp:this.value><![CDATA[
    $("table.dataview").addClass("table-striped table-hover")
  ]]></xp:this.value>
</xp:scriptBlock>