Sitecore sub-items sorting issue - c#

When there is no sorting of sub-items selected, what is the default sorting method? According to the sitecore documentation:
"If you do not specify a child sorting rule for an item, Sitecore applies the Default child sorting
rule, and users can sort items manually."
and it defines default as:
"Default: Sort items alphabetically by name, not interpreting leading
digits as numbers. Leading underscores sort last. This is
the default child sorting rule."
However, I have a script that enters a bunch of items, and I just want them to show in the order I entered them in (which is essentially the 'created' option) - and then I want the user to have control over how they order it after that. Unfortunately, it doesn't preserve the order I entered them in (and doesn't seem to be the default either).
If I choose any of the sub-items sorting option, then the user can't order it anymore... how can I do this? Is there someway to set the starting sort-order, and then still have the user order the items?

What you should do is leave the Subitems Sorting field empty, then add a sort order value (in the __Sortorder field) to each of your items that are being inserted by the script (increase the value by 100 for every item, starting by 100).
That should result in what you want; your items sorted by order of insertion and users can still change their order in the content editor.

Related

When a DropDownList has text not matching the value, similar items will force the selection of the topmost similar item

I have a DropDownList that is filled with data from a database table, in this case, a description.
On the Website it is attached to, the user selects a description and hits a button. The process will then find the matching description in the table and import all of the relevant data for display. This method works perfectly.
However, If instead, I fill the text with the description, and the value with the ItemCode, when I try to have the code use SelectedItem(assuming is used the text field), it will shunt the selection to the topmost of the similar items. for example, a "2x4x12 Pine" and a "2x4x12 Spruce".
The primary key of the table uses ItemCode(2x4x12) and type(pine or spruce). this means that while the description of the two items are different, but the value is the same. could this be why it is shunting the selection to the top of the similar items?
While typing this out I may have rubberduckied the problem.
My best guess is that because multiple items use the same item code, resulting in the same value for multiple fields, that the DDL is selecting the item by value and not text, and this results in the selection being shunted to the top option in a grouping that has the dame value.

How to retrieve bill information for a check in Quickbooks

I want to get the list of all the bills for which a particular check has been generated.
Consider I have 2 grids on a form. 1st grid (gridChecks) displays all the checks in Quickbooks and when user selects a check, all the bills that are linked to that check should be displayed in the second grid i.e. gridBills which will have columns Date, Type, ReferenceNumber, OriginalAmount, Balance, Paid Amount.
I am not able to find how to use IBillPaymentCheckRet or which interface to use and how to use.
The bills to which a check has been applied are referenced in the AppliedToTxnRet element (QBFC: AppliedToTxnRetList). In order to populate this element you'll have to specify it in the IncludeRetElement list for your BillPaymentCheck query request.

Which control to choose apart from DropDownList for large records

I have a UI in which I am using a DropDownList which is pulling from one table and one column. Now this column has lots of records. Probably 1000+.
Now which control should I use?
1000 records in a DropDownList is ridiculous.
Can you break it down?
Are items categorized so you could use a cascading drop down, similar to how you search for cars by YEAR, MAKE, MODEL.
If not, then perhaps show the items as a list of Checkboxes and add paging and sorting.
an auto complete box (like the one described here) could be a good choice. Make sure to set an appropriate delay and a minimum number of characters before searching. You could also limit the number of returned results if two many are found.

DataGridView sort based on value of another row

I have a DataGridView (with WinForms) where I'm treating a particular row as a "child" of the row just before it. This means when a user sorts a column, that child row as to stay attached to the parent so it always appears just below it.
I'm overriding the SortCompare method to handle this, but I'm not sure just how to do it. Within SortCompare, I know if the row has a parent row, and if so what that row is. Therefore I want to be able to say, "if row1 has a parent, let the sort result be whatever it would be comparing row1's parent to row2". But how do I accomplish that without explicitly comparing the values myself (which I want to avoid so I don't have to keep track of the data types)? Is the comparer it's using available anywhere? Or is there just a better way to do what I'm trying to accomplish?
Set SortExpression on the column to any valid column name. It does not have to be itself
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.sortexpression.aspx
I'm guessing you want small groups. Have you looked at the custom DataGridViewGrouper component ?
You could have distinct properties for each row group and use this custom component to create your groups. Each two-row group would have a distinct property that would allow you to group them together. To me, you would have to somehow distinguish individual groups through a distinct tag or property. There is no parent-child relationship in this case, though I don't see that is important since you want to group them.

Get DataGridView columns in order of user's ordering

I have an app that lets the user reorder columns in a DataGridView, and I want to save the "layout" upon closing the app...but it seems that when I iterate through the column collection, I get them in the order I added them, not the order they appear on screen. Is there a way to get the displayed ordering?
edit: found it, just check the DisplayIndex property of each column :)
You'll have to use the DataGridViewColumn.DisplayIndex property. http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcolumn.displayindex.aspx

Categories

Resources