How to focus the second cell when adding a new row to dojo.gridX

I use dojo.gridx to display my values. Sometimes a user may create a new line. To add a new button when the newRow button is pressed, the onclick method is called.

In this method, new row codes are created. My codes are below.

addRow:

 function() { var that = this; var gridIdLocal = dijit.byId('GridId'); that.lastIndex+=1; ( last index count I get externally) var newRow = { Id : '', ClassDES:'', createdDate: that.getTodayDate(), activatedDate:that.getTodayDate(), deactivedDate:'', activeStatus:'Y', id : lastIndex }; gridIdLocal.store.newItem(newRow); gridIdLocal.store.save(); }, 

With this code, I can create a new row, but I want to focus the mouse pointer on the newly added second row column (ClassDES).
How can I achieve this functionality in dojo.gridx ?

+7
javascript dojo dojo.gridx gridx
source share
1 answer

I did not use Dojo gridx, but looking at one of its main demos, it displays a <table> inside a <div> for each row. Using the newRow object from your example above, you can do something like the following with jquery

 function() { var that = this; var gridIdLocal = dijit.byId('GridId'); that.lastIndex+=1; ( last index count I get externally) var newRow = { Id : '', ClassDES:'', createdDate: that.getTodayDate(), activatedDate:that.getTodayDate(), deactivedDate:'', activeStatus:'Y', id : lastIndex }; gridIdLocal.store.newItem(newRow); gridIdLocal.store.save(); $(newRow).find("td")[1].children("input").focus(); }, 

If you could publish a working jsfiddle, it would be easier to solve.

+1
source share

All Articles