Questions tagged [datatable]

The term "datatable" is ambiguous. In .NET, it's a class that represents a table of in-memory data. In component based MVC frameworks like JSF and Wicket, it's an UI component that dynamically renders a HTML table based on a collection. For jQuery DataTables plugin, please use the [datatables] tag, for the data.table R package please use [data.table]. For the Python datatable package, use [py-datatable].

DataTable in .NET

A DataTable is a .NET class that represents one table of in-memory data. Unlike other programming languages and platforms, a .NET DataTable is not a GUI control but rather a representation of a SQL table directly accessible in code and a source of data for other controls.

A DataTable may exist as part of a DataSet, which represents an in-memory relational data store. In that context, they can be connected through instances of the DataRelation class, and constrained by ForeignKeyConstraint or UniqueConstraint instances.

A DataTable has a set of DataColumn instances, which describe its schema. Data is stored in DataRow instances.

A DataTable may be sorted and filtered without changing the data by attaching it to a DataView. The sorted and filtered rows are then accessed as instances of the DataRowView class.


DataTable in JSF

A <h:dataTable> is an UI component which allows you to render a HTML table dynamically based on a given List<Entity>. You can specify columns using <h:column>. Assuming that Entity is a fullworthy javabean with 3 properties id, name and value, here's an example how you can render a dynamically sized HTML table out of it:

<h:dataTable value="#{bean.entities}" var="entity">
    <h:column>#{entity.id}</h:column>
    <h:column>#{entity.name}</h:column>
    <h:column>#{entity.value}</h:column>
</h:column>

DataTable in Wicket

A data table builds on data grid view to introduce toolbars. Toolbars can be used to display sortable column headers, paging information, filter controls, and other information.

Data table also provides its own markup for an html table so the user does not need to provide it himself. This makes it very simple to add a datatable to the markup, however, some flexibility. (from Wicket 1.4.18 Javadoc)

22197 questions
4
votes
1 answer

Set width for JSF column header in fixed-size table

I have a JSF datatable with table-layout:fixed, where I'm trying to set percentage based width for each column. I figured that if i add a width attribute to the header in IE, then it works as expected. However, I cant figure out how to add this…
Stormfjes
  • 83
  • 1
  • 1
  • 8
4
votes
2 answers

Linq join 2 datatables that share a column and put result in new datatable

I have the following datatables table1: +-----------+------+------+ | catalogid | name | snum | +-----------+------+------+ | 353 | xx | 4 | | 364 | yy | 3 | | 882 | zz | 3 | | 224 | mm | 71 | | 999 |…
user1570048
  • 880
  • 6
  • 35
  • 69
4
votes
3 answers

winforms datagridview calculated field change event

I have a datagridview bound from a datatable. I have a calculated column linetotal that multiples unitprice * quantity. I also have a totalprice label,that I would like to contain the sum of the linetotal column in the datagridview. When the user…
muhan
  • 2,537
  • 3
  • 29
  • 33
4
votes
1 answer

How to pass a parameter between two jQuery datatables

I have two datatables, one which lists foldes, and another which list's files within their parent folder. Here is how my script looks for the folder table: var oTable = $('#folderTable').dataTable({ "bServerSide": true, …
Marcus Nizza
  • 71
  • 1
  • 6
4
votes
1 answer

Datatables with rowGrouping unable to hide columns

The JS: $(document).ready(function() { // $( "#dashboard_container" ).tabs(); $('#listings').dataTable({ "bRetrieve": true, "aoColumns": [ …
chris
  • 36,115
  • 52
  • 143
  • 252
4
votes
2 answers

JSF conditionally render footer (jsf facet)

I would like to render a footer (with a specific content) if the datatable content is empty. I found this How do I conditionally render an ? but that doesnt really solve my problem, as it only renderes the footer if the message isnt empty. …
user1323246
  • 433
  • 2
  • 6
  • 23
4
votes
2 answers

How to copy value of one data column into another data column in the same data table C#?

I want to copy itemarray[4] of datatable to itemarray[6] of that datatable. I used this code and I didn’t see any changes: foreach (DataRow dr_row in dt_table.Rows) { foreach (var field_value in dr_row.ItemArray) { object cell_data =…
Mira
  • 131
  • 2
  • 15
4
votes
1 answer

Entity Framework - IQueryable to DataTable

I'm trying to convert an IQueryable object to a DataTable. Here's an example of a query that I would like to convert to a DataTable: var query = DbContext.SomeObjectSet.Select(x => new { PropertyName1 = x.ColumnName1, PropertyName2 = x.ColumnName2…
4
votes
1 answer

VB.Net LINQ - left outer join between two datatables - limit to one row

I have an issue with LINQ in vb.net. Basically I want create LEFT JOIN between two datatables. This is the info of the two datatables: Dim vDT1 As New…
MiBol
  • 1,985
  • 10
  • 37
  • 64
4
votes
2 answers

vb.net load datatable to datagridview

I use the following code to generate a data table from datagridview Dim t1 As New DataTable For Each col As DataGridViewColumn In DataGridView1.Columns t1.Columns.Add(col.HeaderText) Next For Each row As DataGridViewRow In…
user1590636
  • 1,174
  • 6
  • 26
  • 56
4
votes
2 answers

Parallel.For loop freezes

I'm trying to add to a DataTable some information in Parallel but if the the loop is to long it freezes or just takes a lot of time, more time then an usual for loop, this is my code for the Parallel.For loop: Parallel.For(1, linii.Length, index => …
XandrUu
  • 1,169
  • 4
  • 26
  • 46
4
votes
2 answers

UNIQUE constraint on DataTable

Can I have a clustered key on DataTable in C# ? There's a requirement in my code to have constraints for possible combinations of 3 columns to be unique .....
nirav
  • 373
  • 3
  • 7
  • 20
4
votes
6 answers

LINQ Dynamic Expression API, predicate with DBNull.Value comparison

I have an issue using the Dynamic Expression API. I cannot seem to compare a DataTable field against DBNull.Value. The API is supposed to be able to "support static field or static property access. Any public field or property can be accessed.". …
Richard Anthony Hein
  • 10,550
  • 3
  • 42
  • 62
4
votes
3 answers

Linq not in select on datatable

Hi i've got 2 data tables (bannedlist,countrylist), both contains list of country names and cods in columns cc and country. I am trying to do a query where i can select countries from countrylist table that are not in bannedlist table in order to…
nLL
  • 5,662
  • 11
  • 52
  • 87
4
votes
3 answers

A DataTable which having id from other datatables, Need to transform this datatable to replace ids with their datatable name column value

I have N datatables, where N-1 datatables are representing some entities and 1 representing relationship between these entities. like Entity Country Country DATATABLE ID | Country Name | Country Code ------------------------------------ ID1 …
Yograj Gupta
  • 9,811
  • 3
  • 29
  • 48