c1:C1DataGrid 的标题上的筛选问题
c1:C1DataGrid 的标题上的筛选,我试了试,只有纯数字的能筛选成功,列里有字母的就没办法筛选了?是我哪设置的问题吗?前台代码
<c1:C1DataGrid x:Name="MyGrid" AutoGenerateColumns="False"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
CanUserFreezeColumns="None"
IsReadOnly="True"
RowHeight="25"
AlternatingRowBackground="White"
ScrollMode="Deferred"
GridLinesVisibility="All"
SelectionMode="MultiRange"
ColumnHeaderClickAction="Select"
>
<c1:C1RowIndexHeaderBehavior.RowIndexHeaderBehavior>
<c1:C1RowIndexHeaderBehavior InitialIndex="1"/>
</c1:C1RowIndexHeaderBehavior.RowIndexHeaderBehavior>
<c1:C1DataGrid.Columns>
<c1:DataGridTextColumn Binding="{Binding Path=ID}" Width="60"FilterMemberPath="ID" SortMemberPath="ID" Header="ID" />
<c1:DataGridTextColumn Binding="{Binding OrderNo}" Width="105"FilterMemberPath="订单号" SortMemberPath="订单号" Header="订单号"/>
<c1:DataGridTextColumn Binding="{Binding ProdID}" Width="120"FilterMemberPath="物料编码" SortMemberPath="物料编码" Header="物料编码"/>
<c1:DataGridTextColumn Binding="{Binding SlbNo}" Width="100"FilterMemberPath="SlbNo" SortMemberPath="SlbNo" Header="SlbNo"/>
<c1:DataGridTextColumn Binding="{Binding OperaterType_Name}" Width="80"FilterMemberPath="检验类型" SortMemberPath="检验类型" Header="检验类型"/>
<c1:DataGridTextColumn Binding="{Binding Frequency_Name}" Width="77"FilterMemberPath="检验过程" SortMemberPath="检验过程" Header="检验过程"/>
<c1:DataGridTextColumn Binding="{Binding SemiProduct_SerNo}" Width="90"FilterMemberPath="订单唯一码" SortMemberPath="订单唯一码" Header="订单唯一码"/>
<c1:DataGridTextColumn Binding="{Binding prdPerson}" Width="70"FilterMemberPath="工号" SortMemberPath="工号" Header="工号"/>
<c1:DataGridTextColumn Binding="{Binding PersonName}" Width="100"FilterMemberPath="检验人" SortMemberPath="检验人" Header="检验人"/>
<c1:DataGridTextColumn Binding="{Binding Note}" Width="100"FilterMemberPath="备注" SortMemberPath="备注" Header="备注"/>
<c1:DataGridTextColumn Binding="{Binding Recorddate}" Width="100"FilterMemberPath="检验时间" SortMemberPath="检验时间" Header="检验时间"/>
<c1:DataGridTextColumn Binding="{Binding ProcessName}" Width="100"FilterMemberPath="工序" SortMemberPath="工序" Header="工序"/>
<c1:DataGridTextColumn Binding="{Binding ObjectID}" Width="100"FilterMemberPath="料号" SortMemberPath="料号" Header="料号"/>
</c1:C1DataGrid.Columns>
</c1:C1DataGrid>
后台代码
TestDal dal = new TestDal();
DataTable dt = dal.GetCheck_RecordsetMain_Pad(tb_Serno.Text, tb_PersonID.Text,(DateTime) StartDate.DateTime, (DateTime)EndDate.DateTime);
MyGrid.ItemsSource = dt.DefaultView; c1:C1DataGrid 标题点击能排序,是哪个属性设置的,例子上,都能排序,但是好像又没有设置。
比如下面这个例子
<c1:C1DataGrid x:Name="grid" Grid.Row="1"
AutoGeneratingColumn="grid_AutoGeneratingColumn"
CanUserAddRows="False"
RowHeight="30"
IsReadOnly="true">
<c1:C1FullTextSearchBehavior.FullTextSearchBehavior>
<c1:C1FullTextSearchBehavior/>
</c1:C1FullTextSearchBehavior.FullTextSearchBehavior>
</c1:C1DataGrid> CanUserSort ,设置成true了,但是还不能排序,还少什么吗
<c1:C1DataGrid x:Name="MyGrid" AutoGenerateColumns="False"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
CanUserFreezeColumns="None"
IsReadOnly="True"
RowHeight="25"
AlternatingRowBackground="White"
ScrollMode="Deferred"
GridLinesVisibility="All"
SelectionMode="MultiRange"
ColumnHeaderClickAction="Select"
CanUserSort="True"
>
<c1:C1DataGrid.TopRows>
<c1:DataGridFilterRow />
</c1:C1DataGrid.TopRows>
<c1:C1RowIndexHeaderBehavior.RowIndexHeaderBehavior>
<c1:C1RowIndexHeaderBehavior InitialIndex="1"/>
</c1:C1RowIndexHeaderBehavior.RowIndexHeaderBehavior>
<c1:C1DataGrid.Columns>
<c1:DataGridTextColumn Binding="{Binding Path=ID}" Width="60"FilterMemberPath="ID" SortMemberPath="ID" Header="ID" />
<c1:DataGridTextColumn Binding="{Binding OrderNo}" Width="105"FilterMemberPath="订单号" SortMemberPath="订单号" Header="订单号"/>
<c1:DataGridTextColumn Binding="{Binding ProdID}" Width="120"FilterMemberPath="物料编码" SortMemberPath="物料编码" Header="物料编码"/>
<c1:DataGridTextColumn Binding="{Binding SlbNo}" Width="100"FilterMemberPath="SlbNo" SortMemberPath="SlbNo" Header="SlbNo"/>
<c1:DataGridTextColumn Binding="{Binding OperaterType_Name}" Width="80"FilterMemberPath="检验类型" SortMemberPath="检验类型" Header="检验类型"/>
<c1:DataGridTextColumn Binding="{Binding Frequency_Name}" Width="77"FilterMemberPath="检验过程" SortMemberPath="检验过程" Header="检验过程"/>
<c1:DataGridTextColumn Binding="{Binding SemiProduct_SerNo}" Width="90"FilterMemberPath="订单唯一码" SortMemberPath="订单唯一码" Header="订单唯一码"/>
<c1:DataGridTextColumn Binding="{Binding prdPerson}" Width="70"FilterMemberPath="工号" SortMemberPath="工号" Header="工号"/>
<c1:DataGridTextColumn Binding="{Binding PersonName}" Width="100"FilterMemberPath="检验人" SortMemberPath="检验人" Header="检验人"/>
<c1:DataGridTextColumn Binding="{Binding Note}" Width="100"FilterMemberPath="备注" SortMemberPath="备注" Header="备注"/>
<c1:DataGridTextColumn Binding="{Binding Recorddate}" Width="100"FilterMemberPath="检验时间" SortMemberPath="检验时间" Header="检验时间"/>
<c1:DataGridTextColumn Binding="{Binding ProcessName}" Width="100"FilterMemberPath="工序" SortMemberPath="工序" Header="工序"/>
<c1:DataGridTextColumn Binding="{Binding ObjectID}" Width="100"FilterMemberPath="料号" SortMemberPath="料号" Header="料号"/>
</c1:C1DataGrid.Columns>
</c1:C1DataGrid> 回复 3楼llsyz02的帖子
谢谢您的反馈。
很抱歉回复晚了。
设置CanUserSort属性即可实现排序,请参考产品博客:http://blog.gcpowertools.com.cn/post/2015/11/12/C1DataGridWPF_GettingStart.aspx
有关过滤的问题,在随机安装示例中测试,没有重现您提到的问题。
请您参考随机安装示例,对比哪里出问题。
路径如下:
\Documents\ComponentOne Samples\WPF\CS\DataGridSamples 回复 4楼Alice的帖子
CanUserSort ,设置成true了,但是还不能排序,还少什么吗? 回复 5楼llsyz02的帖子
很抱歉您的代码我无法调试,您可以测试2楼所给的随机安装示例是否可以做排序。
只用设置CanUserSort即可,不用其他的设置。
推测您由于设置过多属性,有属性影响到了。您可以删除掉不必要的属性设置,然后再测试。具体原因不知,有可能是比如您设置了只读或是禁止之类的。 回复 6楼Alice的帖子
去掉了属性,ID能排序了,但是,订单号这些列还是不能排序。
<c1:C1DataGrid x:Name="MyGrid" AutoGenerateColumns="False"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
RowHeight="25"
AlternatingRowBackground="White"
ScrollMode="Deferred"
GridLinesVisibility="All"
SelectionMode="MultiRange"
CanUserSort="True"
>
回复 7楼llsyz02的帖子
您的问题我不能重现。
请给我一个重现该问题的Demo,我帮您看看。 回复 8楼Alice的帖子
从项目里哪出来略麻烦,先不处理这个问题了。3Q。:rose 回复 9楼llsyz02的帖子
不用客气。
您可以参考我们的随机安装示例查下是哪里出问题了。
如果有什么问题,欢迎和我们联系。
页:
[1]