Skip to content

Instantly share code, notes, and snippets.

View dontpaniclabsgists's full-sized avatar

Don't Panic Labs dontpaniclabsgists

View GitHub Profile
When building out the columns in the columns section, only use the following properties
- field: The property name in the data object
- header: The column header text
- type: The data type (text, date, number, etc.)
- sortable: Whether the column is sortable
Import and use the ItemListComponent in your template
- import { ItemListComponent } from '../../components/item-list/item-list.component';
- import { ItemListConfig } from '../../components/item-list/item-list.types';
{
field: // name of field
header: // header
type: // field type
sortable: true
},
Team
name
color
leaderId (userId)
leaderName (User’s display name)
`{
field: 'color',
header: 'Color',
type: 'color',
sortable: false,
},`
<?xml version="1.0" encoding="utf-8"?>
<Person>
<First>John</First>
<Last>Doe</Last>
<Age>30</Age>
<Email>[email protected]</Email>
<PhoneNumbers>
<PhoneNumber>123-456-7890</PhoneNumber>
<PhoneNumber>098-765-4321</PhoneNumber>
</PhoneNumbers>
public class Utf8StringWriter : StringWriter
{
public override Encoding Encoding => Encoding.UTF8;
}
```
Using this custom writer, we can write our XML in the same way.
```C#
XmlSerializer serializer = new XmlSerializer(typeof(Person));
using (Utf8StringWriter writer = new Utf8StringWriter())
{
<?xml version="1.0" encoding="utf-16"?>
<Person>
<First>John</First>
<Last>Doe</Last>
<Age>30</Age>
<Email>[email protected]</Email>
<PhoneNumbers>
<PhoneNumber>123-456-7890</PhoneNumber>
<PhoneNumber>098-765-4321</PhoneNumber>
</PhoneNumbers>
var namespaces = new XmlSerializerNamespaces();
namespaces.Add(string.Empty, string.Empty);
XmlSerializer serializer = new XmlSerializer(typeof(Person));
using (StringWriter writer = new StringWriter())
{
serializer.Serialize(writer, person, namespaces);
Console.WriteLine(writer.ToString());
}
<?xml version="1.0" encoding="utf-16"?>
<Person xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<First>John</First>
<Last>Doe</Last>
<Email>[email protected]</Email>
<PhoneNumbers>
<PhoneNumber>123-456-7890</PhoneNumber>
<PhoneNumber>098-765-4321</PhoneNumber>
</PhoneNumbers>
</Person>