Wednesday, December 19, 2012

Scroll grid to selected row in ExtJs 4

Recently I was working on ExtJs project in which there were required to select row as well as scroll grid to selected row.I found focusRow() method of view but only this did't work.We have to set deferRowRender to false it is config of grid.
Following is code for this.

 // preselect record
grid.getSelectionModel().select(  record  );
               
 //scroll grid to selected record
grid.getView().focusRow( record );

we can also use index of row insted of record.

Tuesday, September 18, 2012

How to get CSS class property value in javascirpt


Hello all,
Recently I working with javascript and css and for show and hide some element on base of css class's value.
I try  document.getElementById('elementId').style.display but it's failed because it's work only with inline style.

so I got below javascript code for get value of display property of css class in javascript.

   var elementObj = document.getElementById('elementId');
   var displayType= window.getComputedStyle(elementObj, null).getPropertyValue('display');
    alert(displayType);

displayType is the one of the value from inline,none or block.

Monday, June 25, 2012

Clickable panel in sencha touch 2.0


Some time we need to click on panel and do something but sencha touch panel has no tap event.

Using below code we can click the panel and call any function.

xtype:'panel',
listeners:{
 painted:function(ele){
     ele.element.on('tap',function(){
                      console.log('you click panel');
     });
 }
}

Thanks,
Naresh

Tuesday, May 8, 2012

Display checkboxfield in textfield


Currently I face the issue for display checkbox along with the textfield which inturn was useful for me for bulk action like delete all selected textfield or update value.
While I was searching ,I found the following solution.

xtype: 'textfield',
itemId:'txtMain',
      component: {
          xtype: 'container',
          layout: 'hbox',
          items: [{
            xtype: 'textfield',
            itemId:'txtSubText',
            flex: 1,
            label:'select',
            clearIcon:false
          },
          {
            xtype: 'checkboxfield',
            itemId:'chkField'
          }]
      }

Output of above code is :-


Following code to get the value of textfield and checkboxfield

panel.query('#txtMain')[0].getComponent().query('#txtSubText')[0].getValue();

panel.query('#txtMain')[0].getComponent().query('#chkField ')[0].getValue();

Saturday, March 17, 2012

HTML 5 localStorage usefull methods


With HTML5, web pages can store data locally within the user's browser.

Earlier, this was done with cookies. However, Web Storage is more secure and faster. The data is not included with every server request, but used ONLY when asked for. It is also possible to store large amounts of data, without affecting the website's performance.

The data is stored in key/value pairs, and a web page can only access data stored by itself.

Here I write some usefull method of localStorage.

localStorage.setItem('name','naresh');
This method use for create new items if not exist in localstorage otherwise it overwrite value of item 'name'.

localStorage.getItem('name');
This method give the value of item 'name' of locaStorage.

localStorage.removeItem('name');
This method for remove single and perticuler item from localStorage.

localStorage.clear();
This mehtod use for copmletely clear your localStorage.

Friday, January 6, 2012

Magento Interview Questions


Hello All,
I need interview question of magento and I start googling for it but i get very few question.
So I deside to write some question and answer here.

Q-1 What is Magento?
Ans:- Magento is a feature-rich eCommerce platform built on open-source technology that provides online merchants with unprecedented flexibility and control over the look, content and functionality of their eCommerce store. Magentos intuitive administration interface features powerful marketing, search engine optimization and catalog-management tools to give merchants the power to create sites that are tailored to their unique business needs. Designed to be completely scalable and backed by Variens support network, Magento offers companies the ultimate eCommerce solution.

Q-2 What technology used by Magento?
Ans:- Magento uses PHP as a web server scripting language and the MySQL Database.
      The data model is based on the Entity-attribute-value model that stores data objects in tree structures,
      thus allowing a change to a data structure without changing the database definition.

Q-3 What is entry point in magento?
Ans:- index.php in magento root is entry point of any magento.

Q-4 Explain about the Modules of Magento?
Ans:- Magento supports installation of modules through a web-based interface accessible through the administration area of a Magento installation.
      Modules are hosted on the Magento eCommerce website as a PEAR server.
      Any community member can upload a module through the website and is made available once confirmed by a member of the Magento team.
      Modules are installed by entering a module key, available on the module page, into the web based interface.
   
       There are three categories of modules hosted on Magento Connect:
        ► Core Modules
        ► Community Modules
        ► Commercial Modules
      Core and Community modules can be installed via the administration area. Commercial module pages provide price information and a link to an external website.

Q-5 Explain abut the history of Magento?
Ans:- Varien, the company that owns Magento, formerly worked with osCommerce. They originally planned to discontinue osCommerce but later decided to rewrite it as Magento. Magento officially started development in early 2007. Seven months later, on August 31, 2007, the first public beta version was released. On May 30, 2010, Magento mobile was released; it allows store owners to create native mobile storefront apps.

Q-6 How to upgrade to the latest version using Magento Connect?
Ans:- Upgrading Magento to the latest version is a fairly simple task. Copy and Paste this key magento-core/Mage_All_Latest VIA Magento Connect where it states Paste extension key to install. This will upgrade Magento to the newest version.

Q-7 Why I got Access denied error after installing new Magento extension through downloader and try to access its configuration settings?
Ans:- Just log out then log in.

As I faced new question I will edit this post.

Thanks,
Naresh