datagrid

Change DataGrid column header text

拈花ヽ惹草 提交于 2020-01-02 01:58:31
问题 I have a list of a specific class type Person and I want to make a DataGrid with it. private void DataGrid_Loaded(object sender, RoutedEventArgs e) { List<Person> x; //Don't worry, x has data in it (sender as DataGrid).ItemsSource = x; } And the Person class: class Person { string fName, lName; } After all this I get a table with the headers: "fName" and "lName". How can I change that to: "First Name" and "Last Name"? 回答1: Here the Right way to do it : First Define an ObservableCollection in

EasyUI之dataGrid的行内编辑

狂风中的少年 提交于 2020-01-01 21:43:45
  这个js代码是别人写的,可能不是最好的,但我个人觉得首先能帮助别人解决功能问题的话就特别好。我稍加修改后用在了自己的项目上了,这里贴出来分享一下。后台用的TinkPHP因为都是查增删改比较简单,这里就不贴了。前台效果图因为比较懒,也不贴了。    $(function () { var datagrid; //定义全局变量datagrid var editRow = undefined; //定义全局变量:当前编辑的行 datagrid = TskupluAddPacket.datagrid({ url: ThinkPHP['MODULE'] + '/Tskuplu/getPacketList', //请求的数据源 iconCls: 'icon-save', //图标 pagination: true, //显示分页 pageSize: 15, //页大小 pageList: [15, 30, 45, 60], //页大小下拉选项此项各value是pageSize的倍数 fit: true, //datagrid自适应宽度 fitColumn: false, //列自适应宽度 striped: true, //行背景交换 nowap: true, //列内容多时自动折至第二行 border: false, idField: 'packetid', //主键 sortName :

EasyUI的DataGrid 打印导出

两盒软妹~` 提交于 2020-01-01 21:43:30
1.打印部分   新增print.js // strPrintName 打印任务名 // printDatagrid 要打印的datagrid function CreateFormPage(strPrintName, printDatagrid) { var tableString = '<table cellspacing="0" class="pb">'; var frozenColumns = printDatagrid.datagrid("options").frozenColumns; // 得到frozenColumns对象 var columns = printDatagrid.datagrid("options").columns; // 得到columns对象 var nameList = ''; // 载入title if (typeof columns != 'undefined' && columns != '') { $(columns).each(function (index) { tableString += '\n<tr>'; if (typeof frozenColumns != 'undefined' && typeof frozenColumns[index] != 'undefined') { for (var i = 0; i <

EasyUI的DataGrid 打印导出

孤人 提交于 2020-01-01 21:43:05
EasyUI的DataGrid 打印导出 一直在Winform和WPF的项目,偶尔接触Web都是网上下个模板修修改改就成了,学习的不太深入。 今日遇到一个打印导出datagrid的问题,做桌面项目的打印导出通常我都是直接将数据源拿过来放到我的打印导出模块直接就出来了,但是在web上没有积累,特别是用了EasyUI的DataGrid,一时不知道如何是好。 遂度娘一翻找到如下解决方案: 1.打印部分   新增print.js // strPrintName 打印任务名 // printDatagrid 要打印的datagrid function CreateFormPage(strPrintName, printDatagrid) { var tableString = '<table cellspacing="0" class="pb">'; var frozenColumns = printDatagrid.datagrid("options").frozenColumns; // 得到frozenColumns对象 var columns = printDatagrid.datagrid("options").columns; // 得到columns对象 var nameList = ''; // 载入title if (typeof columns != 'undefined

wpf mvvm displaying observable collection in datagrid

前提是你 提交于 2020-01-01 18:08:22
问题 I need to display all the information of an object in a DataGrid ItemsCollectionA , ItemsCollectionB and ItemsCollectionC are all ObservableCollections . I have a datagrid: <DataGrid ItemsSource="{Binding Path=itemscollectionA}" HeadersVisibility="All" /> This displays all properties in grid format but the ItemsCollectionB and ItemsCollectionC are appearing as (collection). How can I get ItemsCollectionB and ItemsCollectionC to expand the grid downward and out to show their properties as well

Visible rows in DataGrid is off by 1 (counted using ContainerFromItem)

六眼飞鱼酱① 提交于 2020-01-01 15:03:27
问题 I have a DataGrid of variable dimensions dependent upon screen-res. I need to know how many rows are visible to the user. Here's my code: uint VisibleRows = 0; var TicketGrid = (DataGrid) MyWindow.FindName("TicketGrid"); foreach(var Item in TicketGrid.Items) { var Row = (DataGridRow) TicketGrid.ItemContainerGenerator.ContainerFromItem(Item); if(Row != null && Row.IsVisible) { VisibleRows++; } } I'm using the following code to test the vars: MessageBox.Show(String.Format("{0} of {1} rows

Visible rows in DataGrid is off by 1 (counted using ContainerFromItem)

空扰寡人 提交于 2020-01-01 15:03:26
问题 I have a DataGrid of variable dimensions dependent upon screen-res. I need to know how many rows are visible to the user. Here's my code: uint VisibleRows = 0; var TicketGrid = (DataGrid) MyWindow.FindName("TicketGrid"); foreach(var Item in TicketGrid.Items) { var Row = (DataGridRow) TicketGrid.ItemContainerGenerator.ContainerFromItem(Item); if(Row != null && Row.IsVisible) { VisibleRows++; } } I'm using the following code to test the vars: MessageBox.Show(String.Format("{0} of {1} rows

How do you hide a column in a datagrid using the .net compact framework 3.5

血红的双手。 提交于 2020-01-01 12:12:09
问题 I have a DataGrid that is using a DataReader as its datasource. I want to hide the first column of the datagrid. I am using the .net compact framework 3.5. I can find examples for windows forms but the api is changed enough that they don't work. 回答1: You can set the column style width to 0 or -1 . DataGridTableStyle ts = new DataGridTableStyle(); ts.MappingName = "Order"; // Order date column style DataGridColumnStyle cust_id = new DataGridTextBoxColumn(); cust_id.MappingName = "cust_id";

In WPF, how to display AdornerLayer on top of DataGrid

岁酱吖の 提交于 2020-01-01 12:11:04
问题 I am using WPF datagrid from codeplex. I am using DatagridTemplateColumn and I have written datatemplates to display contents in each column. Now I have to display some help message to a user when the any control in datagrid is focussed. For this I thought of using adorner layer. I used ComboBox loaded event and accessed the adrorner layer of it. I then added my own adorner layer with some thing to be displayed there similar to tooltip. Below is the code. TextBox txtBox = (TextBox)comboBox

Slow and Stuttery WPF Grid Scrolling when loaded with large amounts of data (40 columns, 2000 rows)

旧街凉风 提交于 2020-01-01 10:53:15
问题 In a nutshell we're unable to get reasonable scrolling performance from any kind of WPF grid/items control when loaded with heavy amounts of pure data. We've created a static independent prototype using the DevExpress WPF grid and uploaded it here: http://jump.fm/QOTDL We've also tried with the Infragistics and Xceed grid, and the problem is the same. It seems like WPF simply cannot cope with reasonably large data grids displaying lots of data as far as providing a smooth user experience goes