ExtJS: CheckboxSelectionmodel

An ExtJS gridpanel can be extended with checkboxes so it is visual which rows are selected.

Therefor the default selectionmodel of the GridPanel should be replaced with the Ext.grid.CheckboxSelectionModel.

var checkboxselection = new Ext.grid.CheckboxSelectionModel({
    singleSelect: true,
});

Then this object is add on two different place to the GridPanel. Don’t forget the one in the column configuration, this will be the place where the actual checkboxes are coming.

var grid = new Ext.grid.GridPanel({
    store: store,
    loadMask: true,
    selModel: checkboxselection,
    columns: [
       checkboxselection,
       {header: 'Id', sortable: true, renderer: 'string', dataIndex: 'id' },
       {header: 'Name', sortable: true, renderer: 'string', dataIndex: 'name'}
    ]
});

Continue reading ExtJS: CheckboxSelectionmodel

Is PHP suffering from a handicap of a head start?

In dutch we have a nice expression (“Wet van de remmende voorsprong”) and translated in English it is something like The Law of the handicap of a head start. A company or a product can be very innovative but after a initial success it can be too slow to react on changes and then become outdated.

In my opinion PHP is suffering from this particular problem. PHP has made a real fast start and has an made it to a great deal of the websites of today. But now it is suffering from a burden of legacy and innovation is going really slow. To name a few:

  • With the release of PHP 5.3 we finally got namespaces, Java has it by design for a decade or so.
  • Annotations are used in a “poor mans version”, in comments instead of native in the language.
  • Dynamic typing, this is not really a PHP issue but it can work out very dangerous with SQL injections that are possible “by design”. A GET query parameter is not checked anyhow. All checking should be done by the programmer instead default in the language.
  • Refactoring, with the dynamic typing comes another problem that refactoring is almost impossible in large projects. We changing a function signature you must manually search for all references and change them. The only way to find out you forgot one is at runtime. The compiler will not complain.
  • Exception handling is not always used. Some newer classes are using exception throwing when something is going wrong. But a lot of older functions are not using exceptions but still generate a plain old E_ERROR or similar. This way it is impossible to catch some errors and react on it. And then people start using the @ sign.. with all consequences.

I think PHP should react on these legacy problems by supporting optional typing (like Scala does), so a programmer can make a choice and old legacy software will keep running and professional programmers can use static typing. And maybe drop all the old procedural functions or refactor them to support exceptions were possible. This way PHP can become better in my opinion. Because Java becomes very tempting for me 🙂