We have a scenario where we will have to execute stored procedures and display the data on xamgrid. Some of the stored procedure return upto 50K records and therefore we would like to display them using virtual collection. However, we also have a scenario where the output of the stored procedures can change at times(may return new set of columns) based on the business requirement. We would not like to change the model everytime that happens hence we return a standard type of IEnumerable<Dictionary<string, object>>. Please let me know if its still feasible to use virtual collection under the given constraints.
Hi,
sorry for the late response,
there is no problem using VirtualCollection as long as you use a Dictionary<string, object> as items.
From XamGrid point of view you will need to use XamGrid's String Indexers Support feature. This approach will work well if:
I have attached a sample solution outlining this approach(xamGrid part only).
Sincerely,
I have a similar issue in my Xamgrid. But in my case Autogenerated Columns will be false and i am also using IEnumaerable<Dictionary<String, Object>> collection. But i want to know what Type of Virtual Collection should i be creating. I am using LightWeight Silverlight DataTable as given here.
Note :- As you mentioned about "String Indexers Support" feature in XamGrid Link is broken. So could you able provide alternative to that.
Thanks for your quick replay.
I have seen your sample but i have few more Queries.
First i will mention follwoing things.
1) In my case columns are dynamic. so i cant hard code the columns.
2) When i add columns dynamically to the grid conditional formatting is not working. because i feel TextColumn
taking the datatype as object.
Actually i have created one sample. but in that i have not implemented the Virtualization because i didnt get time.
if possible update the same solution for Virtualization and conditional formatting should work for int , decimal kind of columns..
A1: you do not need to hard code the keys you could iterate over the property names in a File and create a column based on the PropertyName
A2: setting AllowConditionalFormatin="True" only enables the conditional formatting. You need to specify the ConditionalFormating rules for each column you are creating.
I have updated your sample with a sample CF rule which is applied if the the Value is int. You could specify the conditional formatting rule that best suits your scenario for every type you want similarly to the one I did for int. For more details about the how the conditional formatting works check out this help article.
About using the Virtual Collection(if this is what you mean by Virtualization) you will need to refactor your service so you could request a certain range of items. For more details about the Virtual Collection you could check the help articles or take a look at the VC samples.
Let me know if you have any further questions.
Regards,
Hi Konstantin,
Thanks for your reply. I have seen your sample. But my problem is actually diffrent.
My Issues are
1) In Column Filter window , Clear text will be shown as Cllear Filter for 'Properties[FN].Value' instead of Cllear Filter for 'FN' .I know this is because the way i have binded the data. please let me know any way i can resolve this. but my datasource will be same collection.
2) I am applying FontWeight property to XamGrid Cell. The FontWeight property is not applied to the column but rest of the other properties are applied. Please Let me know how to apply the FontWeight Property.
3) In my sample when you apply Custom Filter on AGe column you will find only 2 operands. but i want to add all integer operands to the drop down.please provide me the solution.
I have attached the modified the sample and updated with screenshot.
Here the answers of your questions
A1:There is a property you could use to customize the strings displayed. You could add this line in the for cycle where the columns are being initialized:
newColumn.FilterColumnSettings.FilterMenuClearFiltersString = "Clear Filters for " + p.Name;
A2: I assume that you want to set the FontWeight for all grid cells (i got a bit confused looking at the sample - do you want to style only the summery cells?!) - so you could do this defining your style:
<Style x:Key="BoldenCellStyle" TargetType="ig:CellControl"> <Setter Property="FontWeight" Value="ExtraBold"></Setter> </Style> and then feeding it to the xamGrid's CellStyle property:<ig:XamGrid x:Name="igGrid" AutoGenerateColumns="False" CellStyle="{StaticResource BoldenCellStyle}">
A3:You are able to add a custom operands to the filter menu. However there might have some kind of issue with the filtering through Filter menu. I will investigate the issue asap and try to answer Q3 in more complete manner.
P.S. I have attached the updated sample solution illustrating the A1 and A2.
HTH
Hi ,
Thanks you for providing the solution to A1. I think you didn't understand the "A2" Question.
A2:- I want to Set FontWeight to BOLD for particular cell in the XamGrid. Fox Ex. if any negative numbers in the Cell should be in Bold and Background should be in different color.
In the same sample i have added the "SummaryStyle" resource to the "FN" Column but its not becoming BOLD. For Ex. The Column [FN] Value With "Anil1" Should become Bold. Its not happening.
Please Suggest me the exact solution this is urgent.
I took some time to check why you are unable to see the case I created. It seams the case has been assigned to the user that created this forum thread(SilverDev). Sorry for the confusion created. A new support case for you is created its id is: CAS-65032-M8GRHP. Hopefully you will be able to find it in "My Support Activity" section.
Sorry for the confusion once again.
Issue :- "FontWeight isn't applied when the ConditionalFormatRule is Row". you have informed me about a support case - its id is CAS-64389-R40TGY".But I didnt get any notification for this support case.I am not able to find the support case Id, when i went to "My IG -> My Support Activity" or by using the link provided by you.Please if you have a sample could you please attach it. Its my kind request..
I am not sure why you cannot find the case. However, there is no solution to this issue in the case its main purpose is for you to be notified when a there is a Service/Volume release containing the fix for the issue you've reported.
As I said before next service release should be out around the end of the next week or the beginning of the week after that.
I am not finding any Support Activity when i click the link and Even when i went to "MY IG -> MY Support Activity". I think, i might don't have the permissions for that Support activity. if you have a sample could you please attach it. Because my client need very urgently. So any how i have to make Cell BOLD.
You could check out this thread - as Stoimen has replied there the XamGrid does not support the filtering interfaces of the VC. The Stoimen's suggestion looks the best thing you could do to workeround this limitation.
You need to hook up to grid's filtering events to know when the filters are changed. On such a change you need to get the new set of filters and provide them(in the ItemDataRequested event handler) to the call to your service - this way the service will return only filtered data.
Another thing you should do is to inavalidate the VC's cache in order to make the vc to request all the elements in the page. You could do so by calling VC's Refresh() method.
HTH,