我想知道是否有可能使列标题的字体大小和p:datatable的字体更小?
我不知道如何用css做到这一点.
我有一个p:datatable列出用户的.其中一个列包含用户的连接的名字+姓氏,我希望能够在同一个"过滤器字段"中对这两个值进行过滤,以便它尝试匹配名称上的过滤器以及在名字上.
即:用户:"Bob Green"和"Steve Ross",如果我输入过滤器"o",则两个用户都将出现在过滤列表中.
dataTable:
<p:dataTable id="users"
value="#{userCtrl.userList}"
filteredValue="#{userCtrl.filteredUserList}"
var="user"
sortMode="multiple">
<!-- FIRST NAME + LAST NAME -->
<p:column id="col_name"
filterBy="#{user.name} ADD SOMETHING HERE FOR FIRST NAME?"
headerText="Name"
filterMatchMode="contains">
<h:outputText value="#{user.firstName} #{user.lastName}" />
</p:column>
</p:dataTable>
Run Code Online (Sandbox Code Playgroud)
firstName和lastName属性都是字符串.
任何想法,如果这样的事情是可行的?
谢谢!
所以我想DataRow通过在类中添加int 来扩展类显然它很简单
public class DataRowWithInt : DataRow
{
// Properties ///////////////////////////////////////////////////
public int integer
{
get;
set;
}
// Constructor //////////////////////////////////////////////////
public DataRowWithInt(DataRowBuilder builder)
: base(builder)
{
}
}
Run Code Online (Sandbox Code Playgroud)
现在,当您想要创建新行时,您必须调用
DataTable intDataTable = new DataTable();
intDataTable.Columns.Add("temp");
DataRowWithInt row = intDataTable.NewRow();
Run Code Online (Sandbox Code Playgroud)
但这会给你转换错误.我怎样才能避免这个问题,并得到DataRowWithInt到intDataTable?
谢谢.
- 编辑 -
我知道DataTable类不会返回DataRowWithIn.我想创建一个继承的DataTable类,但我不知道在NewRow类上写什么
我正在尝试使用ReportViewer在报表中将两个DataTable添加到表(tablix).
数据表
我将列出一个程序列表和每个程序的改进列表.
这是我正在寻找的一个例子:

我不确定如何设计我的ReportViewer.使用Table(tablix)是一个好方法还是有更简单的方法呢?也许使用Matrix?您将如何设计包含两个DataTable的报告?
我有以下数据表:
<h:dataTable var="row" value="#{myBean.listOfStrings}">
<h:column>
<h:inputText value="#{row}" />
</h:column>
</h:dataTable>
Run Code Online (Sandbox Code Playgroud)
哪个与List<String>:
private List<String> listOfStrings = new ArrayList<String>();
public List<String> getListOfStrings() {
return listOfStrings;
}
public void setListOfStrings(List<String> listOfStrings) {
this.listOfStrings = listOfStrings;
}
Run Code Online (Sandbox Code Playgroud)
当我在字段中输入一个值并保存表单时,它没有将值传递给列表中的字段,这是设置null,我在这里做错了什么?
我有以下问题:我有一个数据表由SQL查询中的数据提供.查询工作得很好,但并不是所有数据都显示出来.我之前删除了其中一个列,并且没有想要读取它,但它没有显示.
有没有办法让这个工作?
基本上,我有这些列:
Name, First name, birthday, gender
Run Code Online (Sandbox Code Playgroud)
现在我删除了gender:
Name, First name, birthday
Run Code Online (Sandbox Code Playgroud)
过了一会儿,我想gender读,但数据表显示如下:
Name, first name, birthday
Run Code Online (Sandbox Code Playgroud)
它的工作,如果我从更改列名gender于sex在SQL查询,但不是一个解决方案,我可以住在一起.如果我更改名称,然后重命名列标题,则在下次刷新时,将恢复名称.如果我重命名列标题,然后更改SQL查询中的列名称,该列将在下次刷新时消失.
有解决方案的人吗?
我在项目中使用角度数据表.我这样使用它:
<table datatable="ng" class="table table-bordered">
<thead>
<tr>
<th>ID</th>
<th>First</th>
<th>Last</th>
<th>Occupation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="person in people">
<td>{{person.Id}}</td>
<td>{{person.FirstName}}</td>
<td>{{person.LastName}}</td>
<td>{{person.Job}}</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
奇怪的是,桌子呈现.但是,它的行为与数据表不同.未加载排序.有没有办法让我查看是否datatables已加载?在我的页面中,我有以下内容:
<link href="/libs/datatables/media/css/jquery.dataTables.min.css" rel="stylesheet"/>
<link href="/libs/angular-datatables/dist/datatables.bootstrap.min.css" rel="stylesheet"/>
<script src="/libs/jquery/dist/jquery.min.js"></script>
<script src="/libs/datatables/media/js/jquery.dataTables.min.js"></script>
<script src="/libs/angular/angular.min.js"></script>
<script src="/libs/angular-datatables/dist/angular-datatables.min.js"></script>
<script src="/js/app.js"></script>
angular.bootstrap($('#myApp'), ['myApp']);
Run Code Online (Sandbox Code Playgroud)
MyApp是手动引导的,因为页面上有多个应用程序.app.js有以下内容:
'use strict';
var myApp = angular.module('myApp', ['ngAnimate', 'ui.bootstrap', 'datatables', 'app.components']);
myApp.controller('MyController', ['$scope',
function ($scope, DTOptionsBuilder, DTColumnDefBuilder) {
console.log(DTOptionsBuilder);
}])
;
Run Code Online (Sandbox Code Playgroud)
打印console.log语句undefined.这意味着我datatables没有被加载.但是,我不确定如何确认.我的控制台窗口中没有看到任何404.所以,我假设我至少下载了必要的库.感觉我没有datatables正确注射.但是,它看起来对我来说是正确的.然而,排序不起作用并且DTOptionsBuilder打印未定义. …
我有一个包含多列的数据表。我想过滤我要做的列:
newDatableName= OldDt.ToTable(false,"col1","col2");
Run Code Online (Sandbox Code Playgroud)
现在假设,我想以动态方式指定列名称,即将所有列名称放入字符串中,然后执行以下操作:
string colnames= "col1,col2";
newDatableName= OldDt.ToTable(false,colnames);
Run Code Online (Sandbox Code Playgroud)
我尝试了上述方法,但不起作用。我什至尝试:
string colname= "\"col1\",\"col2\"";
Run Code Online (Sandbox Code Playgroud)
但它会将列名称的字符串视为一列,并给出错误,指出该列不存在。
任何帮助表示赞赏。
我在搜索有关Datatableas 的最后一个问题datasource时ReportViewer,发现这是解决方案
DataTable table = new DataTable();
table.Columns.Add("value", typeof(string));
table.Columns.Add("price", typeof(string));
table.Columns.Add("quantity", typeof(string));
table.Rows.Add("test1","10","20");
table.Rows.Add("test2", "10", "20");
reportViewer1.LocalReport.DataSources.Clear();
ReportDataSource rprtDTSource = new ReportDataSource("TITLE",table);
reportViewer1.LocalReport.DataSources.Add(rprtDTSource);
reportViewer1.RefreshReport();
Run Code Online (Sandbox Code Playgroud)
但是我得到这个图像
问题是什么 ??
我试图<br>在使用DataTables将其导出到Excel时,保留在HTML表格中使用的换行符.
我按照他们的指南在这里用Regex替换了某些东西:DataTables在导出期间查找和替换.
我能够替换没问题的东西.但我无法取代<br>使相同单元格中的内容保留其换行符的换行符.
这是我的JS:
$( document ).ready(function() {
var fixNewLine = {
exportOptions: {
format: {
body: function ( data, column, row ) {
// Strip $ from salary column to make it numeric
return column === 5 ?
// THIS WORKS: data.replace(/test/ig, "blablabla"):
data.replace( /<br\s*\/?>/ig, '"'+"\r\n"+'"' ) :
data;
}
}
}
};
$('#table2excel').DataTable({
dom: 'Bfrtip',
buttons:[
$.extend( true, {}, fixNewLine, {
extend: 'copyHtml5'
} ),
$.extend( true, {}, fixNewLine, { …Run Code Online (Sandbox Code Playgroud) datatable ×10
c# ×3
jsf ×3
excel ×2
primefaces ×2
reportviewer ×2
angularjs ×1
datarow ×1
filtering ×1
inheritance ×1
input ×1
java ×1
javascript ×1
line-breaks ×1
localreport ×1
regex ×1
resize ×1
sql ×1
string ×1
vb.net ×1
winforms ×1