This is a migrated thread and some comments may be shown as answers.

grid user control edit mode opens a another grid row

2 Answers 122 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Khanh
Top achievements
Rank 1
Khanh asked on 28 Apr 2010, 11:17 PM
Hi all,

I have a problem I can't seem to solve.  I don't have nested grids but I'm calling them parent and child for ease of explaining.

I have a grid (parent).  When I click edit, the gridparent opens in form template.  The form template has a section that contains a user control.  In the user control is a grid (child).  The user control grid has records related to the parent grid.  When I click the edit command button in the user control it opens correctly using inplace edit.  No problem saving.

The Problem
Child - I want to remove the edit button and use the the rowclick to put the child grid in edit mode.  Now clicking the row will open another row in the parent grid. Clicking the row again closes the parent record.  I have no primary id's matching the parent and child.  So I don't understand why it opens a record outside of it's scope.  Again the child grid is self contain so clicking row edit shouldn't open a record from another grid.

Thanks,
Khanh

2 Answers, 1 is accepted

Sort by
0
Khanh
Top achievements
Rank 1
answered on 29 Apr 2010, 05:13 PM
I discovered some information.  The mastertableview name is "parentgrid."  The detailstable name is "Info.".  the user control grid inside the detailstable is called "parentgridx." 

When I run this:
function RowClick(row, args) { 
                var MasterTableView = args.get_tableView(); 
                var index = args.get_itemIndexHierarchical(); 
                if (MasterTableView.get_name() == "parentgridx") { 
                    alert(MasterTableView.get_name() + index); 
                    MasterTableView.fireCommand("Edit", index); 
                } 
            }   
I do see the correct grid that I want.  When it firecommand to edit mode it goes to the "parentgrid" index record instead of "parentgridx."

How can I go to edit mode mode for a particular grid?

Thanks,
Khanh


0
Khanh
Top achievements
Rank 1
answered on 29 Apr 2010, 06:37 PM
I solved it by doing this:

function RowClick(row, args) { 
                var MasterTableView = args.get_tableView(); 
                var index = args.get_itemIndexHierarchical(); 
                if (MasterTableView.get_name() == "parentgridx") {                     
                    MasterTableView.fireCommand("Edit", index); 
                } 
                if (MasterTableView.get_name() == "parentgrid") { 
                    MasterTableView.fireCommand("RowClick", index); 
                } 
                if (MasterTableView.get_name() == "LotHarvest") { 
                    MasterTableView.fireCommand("Edit", index); 
                } 
            }   

Tags
Grid
Asked by
Khanh
Top achievements
Rank 1
Answers by
Khanh
Top achievements
Rank 1
Share this question
or