List Sequence Number Display

K2 smartforms List Sequence Number Display

Recently, I’ve published a K2 smartforms custom control, List Sequence Number Display at K2 Community (

What does the List Sequence Number custom control do?

It helps you print running numbers on the first column of your List View.

List Sequence Number Display in action
Running number after performing a sort on the column header.

But I can already do that with a SQL View or SQL Stored Procedure…

Well, yes you can, but can your solution:

  1. Add running numbers without altering the original data source?
  2. Can it be do the same for data sources other than SQL?
  3. Can it keep the numbering across different pages? (i.e. pagination)
  4. Can it keep the numbering after a executing sort? (i.e. click on the column headers)
  5. Can it update the numbering adding a new record row? (i.e. adding a new row in a editable list)

So, if you solution can’t do it, then go on and try the List Sequence Number Display custom control! =)

Some things I’ve learned while developing the List Sequence Number Display control

Just to share some of the things I’ve learned from developing this custom control

The parent grid’s html entity ID is always the first set of Guid of my control’s Guid combination

If you look at the generated custom control’s ID via a browser’s Developer Tool, you will see something similar to the following:

Viewing the List Sequence Number Display control from Developer Tool
My custom control’s html entity ID

In my sample here, the div tag’s ID is “b113bc00-d8f7-4ce5-ae81-be2a0ecfe68d_5a10bfd9-f955-41b2-87f7-17e88cd158db”. So if I want to find the Grid which my control resides in, I just need to get the first set of GUID (b113bc00-d8f7-4ce5-ae81-be2a0ecfe68d), separated by the underscore symbol (‘_’) and look for the GUID combination in the ID of a “div” tag with the class name “grid”.

Viewing the List Sequence Number Display control from developer tool 2
Parent grid with the GUID as part of the ID.

This is the piece of JQuery I use to get my grid handle.

If you notice, it also checks if the parentIDString found starts with “00000000-“. This is to handle case where by the grid’s View is not within a Form.


Using MutationObserver

The grid has its own JavaScript class with does not expose any event handlers. So the only solution I can come up with is to use MutationObserver to listen to DOM changes. The biggest down side to this approach is that in Microsoft’s Internet Explorer (IE), only version 11 has a proper implementation of this API. In other browsers like Google Chrome, Firefox and Safari, it’s been the default since who knows when, so there’s no problem in executing the control in these browsers.

So what are the changes I’m listening to?

Based on my first set of  observations for display-only view:

  1. On the grid’s div tag, the “pagesize” attribute will be changed whenever a column sort occurs.
  2. On the grid’s div tag, the “listrefreshed” attribute will be written and changes when a list refresh occurs.
  3. On the grid’s div tag, the “actiontype” attribute will change when a row editing event occurs.

With these information, my first observer looks like this:

On my second observation on editable view:

  1. The “pagesize” attribute will not be written in the grid’s tag. So I can use this to confirm whether the current grid is an editable view.
  2. Since there’s no paging in an editable list view, the usual attributes in my first observation cannot be used to trigger the observer. From subsequent testing, I also found that there’s no other usable attributes to observe for change. My solution then is to listen to the “Column Headers” change by inserting my own custom attribute. It seems that when changes occur on an editable list view, it will refresh the column headers as well.

This is my 2nd observer for editable list view.

That’s all I have!

Well, as the section header says, that’s all I have learned from developing the List Sequence Number Display control. If you are interested in the codes, you can download it from the project from the link at the top of this post. Enjoy!

I ____ Project Manager (add your own words in the space)

So, have you added your words? depending on which position you are in, it can be any of the following:

1) I want to be a PM (very common when interviewing people)
2) I am a PM
3) I was a PM

So what makes someone want to be a PM? in my view, everyone wants to be directing others and not do the actual work. They are happy with attending meetings, taking minutes (provided they actually do that), coordinating meetings and on occasion do the presentation on the schedules and issues encountered, and they will be complaining to their team that being a PM is not easy as it is very time consuming because they have to coordinate meetings, attend meetings and the single phrase that irks (at least for me) “I have to take the bullet for the team”.

One thing I find most telling on whether the PM to be or claimed PM has the skills or knowledge is when it comes to scheduling, if the PM lacks the knowledge, they tend to over estimate the schedule and that might mean they will just add 5% (or whatever they fancy) to whatever schedule the team-mate came out with and when asked why 5% and not 10% since they are already buffing, they might say its a “gut feeling”.

Based on PMP definition:

”Project Management is the application of knowledge, skills, tools and techniques to project activities to meet project requirements. The Project Manager is the person responsible for accomplishing the project objectives.”(PMBOK® Guide, Third Ed., 2004, Section 1.3)

If everyone is to just accomplish the above points stated in paragraph 1, does that make them out to be a PM? Do they actually have the knowledge or skills necessary to meet the project requirements? and this is especially so if the project is a technical project.

In my view, to be a PM is more then doing what was stated above, it requires the unseen skills like:

– knowledge in the area of work (and I am not talking about coordinating or writing minutes), if its IT project, knowledge in the IT area
– necessary certification (PMP, CSITPM)
– leadership skills
– management skills

So if you want to be a PM (point 1) ensure that you actually have the necessary background or skills first before you actually become a PM. What can be worse then facing backlash from your own team members who knows that you know nothing beyond arranging for meetings and coordinating meetings! What’s more, without the background knowledge in the area of the project, you might be taken for a ride by the vendor. Most good PMs will have some knowledge in the area of the project, example if its a technical project then technical knowledge in that area.

If you are a PM (point 2), great! but have you ask yourself, are you actually able to inspire your team during difficult times (leadership skills), manage the schedule and risks as well as distribute the tasks accordingly (management skills) and have the necessary knowledge for the project (domain knowledge). Of course, it can be difficult to be up to date with the latest technical skills BUT that is no excuse to not try and keep up to date, believe me, your team will be impressed when you can actually rolled up your sleeves and help them in their coding. And you will probably not be taken for a ride by the vendor or your developers. So far in most projects I have been on, the customers will rather be talking to the technical PM (if the company actually have separate roles) then the general PM as they realised that they do not get any answers from the general PM since the general PM have to go back to the technical person to get the information.

If you were a PM (point 3), its either you went up next level (project director perhaps?) OR you decided that being a PM is not to your liking, either way, you have gone through the thick and thin of being a PM.

The above are just my own views. Do leave a comments if you have something to share.

Github on K2 Blackpearl & K2 Smartforms.

K2 Services Objects



K2 Smartforms










K2 Misc