Friday, April 18, 2014

GridView customization: choosing the approach

What I want to do is to allow user to choose which columns are visible and in which order they should be shown. For that I am going to create a window with a ListBuilder, like this:



The question is how to activate this functionality?

The options I have:

1. Add some visual element to the template

This could be nice, if I could find an elegant way to fit it into the current visual design (I am not saying it is amazing design now, I am saying that I might make it even worse).

This is something that I see in the Windows Explorer



The problem is, triggering this functionality should be as easy on touch screens as with the keyboard/mouse.
Second problem, it becomes an integrated part of the GridView and it is more difficult to make it optional.

2. Add the context menu to every GridView column

This is one of the possible answers for the previous item. Instead of adding the completely new visual element, I could just add a context menu, which already exists.

This works in Windows Explorer too, and this is something you can find in many other applications, like VisualStudio or MS Outlook.



While it solves the "design problem", it doesn't completely solves other issues.

3. Move this functionality completely out of the GridView and force developer to trigger it

In this case I simply implement the method that creates a window allowing to select/reorder columns, add it to the GridView and allow developer to call it when it is required.

You can see this approach in Windows services console or task manager.



This gives a developer a freedom to enable/disable this feature, implement it differently and choose how it is triggered.
Of course, you don't get this feature for free anymore.

Something that I noticed, for the task manager in Windows 8, they moved this feature out of the main manu and now it is accessible through the context menu.

4. Do not implement this functionality at all.

This is also an option. I can simply create an example code that demonstrates how to do it, and that's it.

The good thing, I spare myself a lot of problems, like localization of that window. The bad thing... Well, I don't think anyone will ever get that far to even see this example.


So I am still choosing. Any suggestions, anyone?

Tuesday, April 15, 2014

Control's Life

Today I will explain the life cycle of the redui control.

Create

At this stage control gets all the properties and methods.
Most of the properties will be still empty, but the most important ones: id and the type should be set.

Initialize from model

At this point control model is validated and normalized.
Optional model properties that were not provided are set to their default values. For example, TextBox label, if not provided, is set to "".

Also at this point has a chance to pre-calculate some values. For example, ComboBox options will be retrieved at this moment, packed into objects, stocked into the array and saved on the options property.

At last, it is a moment (and responsibility) of a control to create and initialize its inner controls.

Render to HTML

All the rendering logic is inside the template. If a control has inner controls, they should be rendered through the template.

Activate

This is a time to subscribe to DOM events.
One of the most important events is change, which allows databound control to update the object it is bound to.

As with the other stages, the control is responsible to activate every inner control!

Set Value

This will only happen for databound controls.
All control has to do is to apply the passed value to the DOM element. For example, TextBox needs to set the value of its INPUT element.

Get Value

This will only happen for databound controls. Control needs to return the updated value from the DOM element.

Welcome Back

It's been a while since I wrote to this blog.

So what happened since the last post?

  1. Now I have a website: redui.net
  2. I have a big section with examples which explain almost every feature of the library
  3. I have a demo application which shows what you can do
  4. I recorded couple of videos that no one is watching
  5. I have a nuget package that allows you to start development immediately
  6. I have people who come to my site:
  7. I have 8 people following me on codeplex
This is a incredibly motivating to see people coming, even for the short visit. So thank you all!

But I think it was a big mistake to stop blogging.
I will try to fix it.

Friday, September 14, 2012

Xml VS Json

Question still to be answered: Xml or Json as a UI modeling language?


Control Rendering From Templates

I din't want to hardcode the rendering part, so I decided to use html templates instead. Templates will be delivered as a part of the library, but it is a standard html which can be easily adjusted.