How do I add differing numbers of leading zeroes?

Let’s say that I have a grid like so:

mygrid = new dhtmlXGridObject('gridbox'); mygrid.setImagePath("/dhtmlx/dhtmlxGrid/codebase/imgs/"); mygrid.setHeader("ID, REVISION, SERIALNUMBER"); mygrid.attachHeader(" ,#numeric_filter,#numeric_filter); mygrid.setInitWidths("100,100,100"); mygrid.setColAlign("right,right,right"); mygrid.setColTypes("ro,ro,ro"); mygrid.setColSorting("num,num,num"); mygrid.init(); mygrid.setColumnHidden(0,true); mygrid.enableMultiselect(true);

How can I modify this code so that values in the REVISION column will always have three digits (e.g. 3 will be shown as 003), and values in the SERIALNUMBER column will always have five digits (e.g. 15 will be shown as 00015)?

Thanks in advance!

Default formatting capabilities doesn’t support such formatting scenario.
You can create your own column type, in such case you will be able to define custom render method with any custom formatting logic.