Friday, October 30, 2009

ExtJS GridPanel autoExpandColumn issue with IE

Issue: In Internet Explorer the column set to autoExpand will go beyond the page width. The Grid will not fit into browser

Solution: Change the attribute in the CSS file:
File Name: ext\resources\css\ext-all.css
Code change:
Original: .x-grid3-header-offset{padding-left:1px;width:10000px}
Code fix: .x-grid3-header-offset{padding-left:1px;width:auto}

Monday, October 19, 2009

Aggregation with String in SQL Server

The following code will do the similar functionality of a amount column summation for String data (String concatenation)

SELECT DISTINCT Author, Titles
FROM (select Title, Author from BookStore) a
CROSS APPLY ( SELECT Title + ' '
FROM (select Title, Author from BookStore) b
WHERE a.Author = b.Author
ORDER BY Author
FOR XML PATH('') ) D ( Titles )

Reading large XML File

Here is the code for reading large XML file, this code works faster than opening the file in any other application.

XmlTextReader xtrInput;
XmlDocument xdItem;
xtrInput = new XmlTextReader("sample.xml");
int i = 0;
while(xtrInput.Read())
{
while (xtrInput.NodeType == XmlNodeType.Element && xtrInput.Name.ToLower() == "record")
{
i = i + 1;
xdItem = new XmlDocument();
xdItem.LoadXml(xtrInput.ReadOuterXml());
xdItem.Save("file" + i.ToString() + ".xml");
}
}
xtrInput.Close();