Browser engine performance related to JavaScript

Question: Which browser engine perform better when it comes to JavaScript?

 

Browsers tested:


  • Firefox version 3.5.2
  • IE8.0.6001.18702
  • Google Chrome 1.0.154

Results:

 

When it came to rendering a complex page with lots of jQuery client-side activity, they all performed well, but Google Chrome is definitely faster than Firefox as well as IE8. However, in one of the screens I loaded multiple grids (jqGrid) that each calls the server via Ajax asynchronously. The interesting result here is that IE8 outperforms Firefox and Chrome by an order of magnitude. It loaded the 5 grids visibly about twice as fast as both Firefox and Chrome, the last two performing visibly the same. Without getting in to too much technical jargon, IE8 obviously performs some kind of parallel call whereas the other two rendering engines perform the different Ajax calls in sequence. When it comes to design and development work requiring WYSIWYG results, Firefox is king with the Firebug, YSlow, CacheViewer, and other plug-ins. I can recommend Chrome when client-side performance is crucial to users, but Firefox is hard to beat when it comes to plug-in support, security, adherence to HTML and CSS standards compliance.

 

To put it into perspective here are some stats on the content rendered:

3429 DOM elements on the page!


doc (1) 63.5K    
js (2) 1532.3K    
css (2) 234.4K    
cssimage (25) 38.1K    
image (22) 33.1K

 

 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

jqGrid hide columns but show when editing/adding

Issue:

I have a grid which I have what I can only describe as containing “Core” data and “Minor” data. What I'd like to be able to do is to show the Core data in the main grid view but to allow the user to add/edit/view the Core and Minor data when they open the relevant dialog.

In essence this would be like having hidden columns that were viewable/editable when the dialogs were opened with form editing/viewing.

The Minor data is only of interest to some users, so I don't want to show it in the main grid view and this would also help keep the grids width down and not have a long horizontal scroll.

Is this possible?

Short answer: YES it is very possible and very well supported in the jqGrid

Long answer:

Here is an example, it contains a lot but wanted to also show you some other tips that you may find helpful, see the explanation of the tip by matching the color with the colored comment at the end of this post.

 

        .jqGrid({
            url: listURL,
            postData: { accountId: $('fieldset#AccountDetails #Id').val() },
            datatype: “json”,
            colNames: ['Id', '', 'Name', 'First Name', 'Middle name', 'Last Name', 'Phone', 'Email', 'Activity', 'Title', 'Prefix', 'Suffix', 'Account Role', 'DM Role', 'DISC Profile', 'Notes'],
            colModel: [
                { name: 'Id', index: 'Id', width: 35, sortable: true, align: "center", resizable: false, hidden: false, editable: false, editoptions: { readonly: true, size: 0} },
                { name: 'EditUrl', index: '', width: 28, editable: false, sortable: false, align: "center", resizable: false },
                { name: 'FullNameUrl', index: 'FullNameUrl', width: 80, editable: false, sortable: true, align: "left", resizable: true, editrules: { edithidden: false} },
                { name: 'FirstName', index: 'FirstName', width: 40, editable: true, sortable: true, align: "left", resizable: true, hidden: true, editrules: { edithidden: true, required: true} },
                { name: 'MiddleName', index: 'MiddleName', width: 40, editable: true, sortable: true, align: "left", resizable: true, hidden: true, editrules: { edithidden: true} },
                { name: 'LastName', index: 'LastName', width: 40, editable: true, sortable: true, align: "left", resizable: true, hidden: true, editrules: { edithidden: true} },

                { name: 'PhoneNumber', index: 'PhoneNumber', width: 80, editable: false, sortable: false, align: "left", resizable: true },
                { name: 'Email', index: 'Email', width: 80, editable: false, sortable: false, align: "left", resizable: true },
                { name: 'ActivityStatus', index: 'ActivityStatus', width: 40, editable: true, sortable: true, align: "left", resizable: true, edittype: "select", editoptions: { value: allActivityStatuses }, editrules: { edithidden: true, required: true} },
                { name: 'Title', index: 'Title', width: 80, editable: true, sortable: true, align: "left", resizable: true },
                { name: 'Prefix', index: 'Prefix', width: 80, editable: true, sortable: true, align: "left", resizable: true, hidden: true, editrules: { edithidden: true} },
                { name: 'Suffix', index: 'Suffix', width: 80, editable: true, sortable: true, align: "left", resizable: true, hidden: true, editrules: { edithidden: true} },
               {name: 'ContactRoleNames', index: 'ContactRoleNames', width: 40, editable: true, hidden: true, hidedlg: true, edittype: "select", editoptions: { multiple: true, size: 4, value: allAccountRoles }, editrules: { edithidden: true, required: true} },
                { name: 'DMRole', index: 'DMRole', width: 30, editable: true, sortable: false, align: "center", resizable: false, edittype: "select", hidden: true, editoptions: { value: allDMRoles }, editrules: { edithidden: true, required: true} },
                { name: 'DISCProfile', index: 'DISCProfile', width: 30, editable: true, sortable: false, align: "center", resizable: false, edittype: "select", hidden: true, editoptions: { value: allDISCProfiles }, editrules: { edithidden: true, required: true} },
                { name: 'Notes', index: 'Notes', width: 85, editable: true, sortable: false, align: "left", resizable: true, edittype: "textarea", editoptions: { rows: "2", cols: "40"} }

 

            ],

To your question, I display the Full Name of the contact, but want to hide the full name when editing but show the FirstName, MiddleName and LastName when editing/adding. Notice the “hidden: true, editrules: { edithidden: true}” properties.

This EditUrl is visible in the grid, but its just an image hyperlink to another page and cannot be edited, hence, “editable: false

The DISCProfile column has a drop down box with dynamically loaded data: “editoptions: { value: allDISCProfiles }“. This data is retrieved before the grid is defined in the JavaScript file with:

var allDISCProfiles = $.ajax({ url: $('#ajaxAllDISCProfilesUrl').val(), async: false, success: function(data, result) { if (!result) alert('Failure to retrieve the DISC Profiles.'); } }).responseText;

 

Hope this helps


  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
Twitter