Extjs – Load the first record in a grid after the data store loads

Here’s a really quick bit of code that will select the first row in an ext data grid after the store gets loaded. I use this all the time as I generally have events connected to a row click, such as populating a form, or showing a grid in another panel, and I have been told by many users that they do not like to fire up the app and see blank space, etc. This provides a quick solution.

Ext.getCmp('your-grid').store.on('load', function(){
                                var grid = Ext.getCmp('your-grid');
                                grid.getSelectionModel().selectRow(0);
                                grid.fireEvent('rowclick', grid, 0)
}, this, {
single: true
});

The Extjs Tooltip in a nutshell

The tooltip is the small box that hovers over an object, or area on the page and contains information that is directly related to that area. Common uses for a tooltip include, display help type information for the object that the user is hovering over, displaying the data source for a section in a chart, displaying captions for images, maps when you hover over addresses, the list is never ending. The main point is you can use this to save screen space and de-clutter your user interface by hiding what only needs to be seen when a user wants to take a closer look at an object. The tooltip consists of a title and body, both of which may be updated independently of one another.

The body can be updated by using the following code:

 this.update(‘Some html or text here’);

The title may be updated by using the code below:

 this.setTitle(‘Title’);

One more helpful tip, I usually get a lot of users that comment on how much they like the tooltip, but wish that it would remain visible just a while longer while they read all of the text or look over the embedded chart or grid (in extjs 4!). The extjs tooltip allows you to set the delay in milliseconds that the tip will remain visible. To accomplish this just add the following line where the numeric value is the number of milliseconds before the tooltip fades away:

 hideDelay:500 

One of the reasons I like to use tooltips is to show the data inside of a cell in a datagrid, as cells are often shorter than the length of the data they contain. In the datagrid just use the following renderer and your cell values will be displayed in a tooltip when the user hovers over the cells.

function showValueInToolTip( value , meta ) {
	meta.attr = 'ext:qtip="' + value + '"';	
	return value;
}

A new way to look at the Heat vs Mavericks NBA Finals Games 1 – 4

OK sports are great for the fact that they are a statisticians dream, so many numbers, so many angles, who could blame them. I just came across this impressive set of graphs in the Washington Post that depict the NBA finals this year, where the Miami Heat are struggling against the Mavericks despite the fact that they seem to have a dream roster. The large graphs depict the flow of the game through the 4 quarters showing the total points per team, time that the teams led during the game, and final score. Directly under each of the graphs you see 4 bar charts that represent each quarter and display the minutes that each team led, and finally under the bar charts is a pie chart that shows the total minutes that each team led during the game. This is an excellent example of an executive dashboard, and turning mundane statistics into information.

A good example of an executive overview

Deliberate Practice

I have been reading several things at once as always (I have a habit of pursuing a couple chapters of a book, then a few magazines, several websites, and admittedly since I live in the Washington area, the Sunday post makes the list on half of the weeks during the year) and a couple of articles caught my attention this week first for their complete contradictions, then after some thought, how similar they really are. First, if you get the chance the book, ’97 things every programmer should know’, which contains some really interesting insight into several pressing topics of importance to the programming community, contains an article by Jon Jagger title, ‘Deliberate Practice’ that contains a sort of formula for success that applies broadly to all tasks. The distinction between deliberate practice and what we do every day for pay .. be it coding, basket weaving, getting an education, whatever you are into .. is simple, the things that you are paid to do, required to do, that lead to concrete end result, as in shipping a product to a customer, receiving a diploma require a focused approach that often leaves little room for exploration, innovation, and to be honest much thought.

Deliberate practice, on the other hand, is setting out to apply your trade, craft, ideas to new and interesting problems. Problems that you may not get the chance to work on during your 9-5 life. These are the things that fall in the, ‘I wish I could just …’ category of projects. As the article states, deliberate practice is done to master the task, not complete the task.

Now, fast forward to this Sunday’s Washington Post where you will find an article by Naomi Schaefer Riley about the alarming rate at which the United States seems to be falling behind academically, or more accurately, how the developing world is catching up to the United States at an alarming rate of speed. The author bases this on a belief that tenured teachers in our universities reach that status and somehow stop being inquisitive, insightful, or driven. The author also longs for a curriculum that is paired down to the bare essentials. The declining value of education has been a popular prediction for as long as I can remember You can read the article here . One of the sentences in the story is so repetitive, you have to wonder if it has been accepted as a truth by virtue of being retold countless times. Of course I am talking about, “Executives at U.S. companies routinely complain about the lack of reading, writing and math skills in the recent graduates they hire.” In a country with labor laws that favor corporations, I have to wonder who forced these executives to hire such ill prepared graduates.

The author fails to see tenure as the ability to exercise deliberate practice, and the students education is in fact a four year study in deliberate practice.

Certain trades lend themselves to repetition, experience, and a strictly by the book approach to the task at hand, these are the trades that have been outsourced. On the other hand, those trades dependent on creativity, invention, and innovation – in short those that rely on practitioners of deliberate practice will remain relevant in the future.

The catch, deliberate practice often looks like a series of small failures or irrational projects at the time, and only later proves to be the sort of risk taking that moves countries and companies forward.

What’s really important is in the details

There are three major points to the video below, first, everything matters, and second, there is no better time to start anything than the present, if only for the fact that the future does not come with a guarantee. The third may not seem obvious to those who do not develop software for a living, or make some kind of tangible object, and that is the little things matter, and they matter more often than you would think. The reason behind this is simple; let’s take an analogy of an automobile. If you were to go out today after reading this post and look for a new car, you would expect the major things to be, well, ‘standard’. You would expect a warranty of some kind, for tires and an engine that runs, maybe even air conditioning and a CD player depending on where you live. You would likely open the door and sit in the car, the dash, the controls would be new and old at the same time, but you might notice the real wood trim, not the plastic stuff, or the painted two tone dash, or the fact that when you turn on the window defroster the air conditioning starts (to remove the condensation), those are the little things that you remember. Remember, everything counts!