Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi there,
A few days ago I upgraded my uComponents from 5.4.1 to 5.5.0 and everything seems fine except that the datagrid is not sorting the rows.
Any ideas?
Many thanks
mkariti
Just for reference - sorting it via Xdoc for now.
XDocument xDoc = XDocument.Parse(CurrentPage.history.ToString());
var doc = xDoc.Element("items").Elements("item").OrderByDescending(n => n.Value);
XDocument sortedGrid = new XDocument(new XElement("items", doc));
loop:
@foreach (XElement xe in sortedGrid.Descendants("item"))
{
@xe.Element("year").Value
}
Thanks
Well.. you should sort on "sortOrder" attribute of your datagrid item.
take a look at the datagrids XML, stored in your umbraco.config, could besomething like that,,..
<datagrid> <items> <item id="1" sortOrder="3"> <news nodeName="Image" nodeType="1034">1111</image> </item> <item id="2" sortOrder="1"> <news nodeName="Image" nodeType="1034">1121</image> </item> <item id="3" sortOrder="2"> <news nodeName="Image" nodeType="1034">1311</image> </item> </datagrid>
happy coding (c:
XDocument xDoc = XDocument.Parse(datagrid);
var doc = xDoc.Element("items").Elements("item").OrderBy(n => int.Parse(n.Attribute("sortOrder").Value));
return sortedGrid;
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Data grid wont sort.
Hi there,
A few days ago I upgraded my uComponents from 5.4.1 to 5.5.0 and everything seems fine except that the datagrid is not sorting the rows.
Any ideas?
Many thanks
mkariti
Just for reference - sorting it via Xdoc for now.
XDocument xDoc = XDocument.Parse(CurrentPage.history.ToString());
var doc = xDoc.Element("items").Elements("item").OrderByDescending(n => n.Value);
XDocument sortedGrid = new XDocument(new XElement("items", doc));
loop:
@foreach (XElement xe in sortedGrid.Descendants("item"))
{
@xe.Element("year").Value
}
Thanks
Well.. you should sort on "sortOrder" attribute of your datagrid item.
take a look at the datagrids XML, stored in your umbraco.config, could besomething like that,,..
happy coding (c:
XDocument xDoc = XDocument.Parse(datagrid);
var doc = xDoc.Element("items").Elements("item").OrderBy(n => int.Parse(n.Attribute("sortOrder").Value));
XDocument sortedGrid = new XDocument(new XElement("items", doc));
return sortedGrid;
is working on a reply...