6/30/2025 5:29:55 PM
|
|
slxdeveloper.com Community Forums |
|
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
|
|
|
|
Enabling Paging and Sort on Datagrid and GetByMethod
Posted: 23 Feb 10 7:44 AM
|
Hello everyone,
Actually, I'm populating the grid when i click on a refresh button by code using a BR. So, my question is if it is posible that the default Sort and Paging works, or do i have to do some extra coding or configuration for it to work. If that the case can someone pont me to the right direction.
Thanks a lot,
John |
|
|
|
Re: Enabling Paging and Sort on Datagrid and GetByMethod
Posted: 23 Feb 10 11:11 AM
|
Hi,
Default paging and sorting should continue to work fine.
Unless your BR is returning some funny objects...if it is you wil get an error when you try to sort on that property. What is the BR?
Thanks, Nick |
|
|
|
Re: Enabling Paging and Sort on Datagrid and GetByMethod
Posted: 24 Feb 10 6:58 AM
|
In fact, the BR its not returning anything. Im setting the datasource through code. I did this because i had a huge SQL query and i wasn't able to do it with NHibernate
System.Data.DataTable oDataTable = account.GetBinderSummary(from, to, callerEntity, isContact) as System.Data.DataTable; System.Collections.Generic.IList sa = new System.Collections.Generic.List(); Sage.Entity.Interfaces.ICSystemAbstract02 saItem;
decimal? currentPremium = 0; decimal? expSubmissionPolicyPremium = 0; DateTime? boundDate = null; DateTime? policyEffectiveDate = null; DateTime? policyExpirationDate = null; if (oDataTable != null) { foreach (System.Data.DataRow dr in oDataTable.Rows) { saItem = Sage.Platform.EntityFactory.Create(); currentPremium = Convert.ToDecimal(dr["CurrentPremium"]); expSubmissionPolicyPremium = Convert.ToDecimal(dr["ExpSubmissionPolicyPremium"]); policyEffectiveDate = CheckForNullDate(dr["PolicyEffectiveDate"]); policyExpirationDate = CheckForNullDate(dr["PolicyExpirationDate"]); boundDate = CheckForNullDate(dr["BoundDate"]); saItem.HouseNumber = dr["HouseNumber"].ToString(); saItem.SubmissionNumber = dr["SubmissionNumber"].ToString(); saItem.PolicyTypeCode = dr["PolicyTypeCode"].ToString(); saItem.NewOrRenew = dr["NewOrRenew"].ToString(); saItem.Insured1 = dr["Insured1"].ToString(); saItem.BoundDate = boundDate; saItem.PolicyEffectiveDate = policyEffectiveDate; saItem.PolicyExpirationDate = policyExpirationDate; saItem.SubmissionStatusCode = dr["SubmissionStatusCode"].ToString(); saItem.Underwriter = dr["Underwriter"].ToString(); saItem.LOB = Convert.ToString(dr["C_LOB"]); saItem.DOB = dr["C_DOB"].ToString(); saItem.CurrentPremium = currentPremium; saItem.ExpSubmissionPolicyPremium = expSubmissionPolicyPremium; if (saItem != null) sa.Add(saItem); } } } Sage.Platform.Controls.IDataGridControl grd = grid as Sage.Platform.Controls.IDataGridControl; if (grd != null) { grd.DataSource = sa; grd.DataBind(); } } private static DateTime? CheckForNullDate (object value) { if (value == null || value == "" || value == System.DBNull.Value) return null; return Convert.ToDateTime(value); } |
|
|
|
Re: Enabling Paging and Sort on Datagrid and GetByMethod
Posted: 09 Mar 10 8:16 AM
|
Sorry this one has been here a while...anyway if you are binding to an Ilist as long as your columns are all part of the "base" entity that the grid is bound to it should be fine. It looks like they are. When I say "base" I mean not joining to another entity. As has been mentioned before (something to with lazy loading in SLX (im paraphrasing here, see Mark Dykun's interesting post: http://codesnap.wordpress.com/2009/05/05/unwrap-that-object-my-friend/ ) if you join to a child property it cannot be resolved when trying to sort so you get an error something like "property X is not found in entity Sage.Entity.Interfaces.ICUSTOMENTITY".
THis doesnt seem like the most economical way of achieving the functionality you want (there MUST be an overhead in calling an EntityFactory.Create for every row in the grid). If you have the SQL why not just create a SQLDataSource, set its SelectCommand, its connection string and its type and set the grid to the datasource and bind it. That way too for sure the sorting and paging will work.
Thanks, Nick |
|
|
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|