IT Hit WebDAV Ajax Browser Custom Columns

211 views Asked by At

I am looking at a trial of the Ajax Browser Control by ItHit. So far it seems to be pretty responsive when it comes to pulling files across http protocol.

What I want to do at this point is have the details view pull custom properties from my excel workbooks. What is the most efficient way to connect my C# code that gets the custom properties to the Ajax control to display the correct values?

1

There are 1 answers

2
IT Hit WebDAV On BEST ANSWER

The easiest way to create a custom column is to return custom property from a WebDAV server. In the example below the server returns price in PricesNs:RetailPrice property.

On a client side you will define a custom column and specify custom property name and namespace:

{
    Id: 'MyColumn1',
    CustomPropertyName: 'RetailPrice',
    CustomPropertyNamespace: 'PricesNs',
    Text: 'Retail Price',
    Width: '150px'
}

Another approach is to return an HTML from a Formatter function specified for column. You have a full control over what is being displayed in this case.

You can find more details and an example in this article: http://www.webdavsystem.com/ajaxfilebrowser/programming/grids_customization/

In case your WebDAV server is running on IT Hit WebDAV Server Engine, to return the requested property, you must implement IHierarchyItem.GetProperties method (or its asynchronous counterpart):

public IEnumerable<PropertyValue> GetProperties(IList<PropertyName> names, bool allprop)
{
    if (allprop)
    {
        return getPropertyValues();
    }

    List<PropertyValue> propVals = new List<PropertyValue>();
    foreach(PropertyName propName in names)
    {
        if( (propName.Namespace == "PricesNs") && (propName.Name == "RetailPrice") )
        {
            // Depending on the item you will return a different price,
            // but here for the sake of simplicity we return one price regerdless of the item
            propVals.Add(new PropertyValue(propName, "100"));
        }
        else
        {
            ...
        }
    }
    return propVals;
}