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

[Solved] eventArgs.get_itemIndexHierarchical ist null

6 Answers 277 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Adriane
Top achievements
Rank 1
Adriane asked on 26 Jan 2010, 09:07 AM
I have the problem that if I click on a row I need to get the row to editInline.
But when I use

function RowClick(sender, eventArgs) { 
 
if (selectedRow == eventArgs.get_itemIndexHierarchical() ) { 
 
 editedRow = eventArgs.get_itemIndexHierarchical(); 
$find("ctl00_masterdetail_MasterDetailControl_detailrecords_positionGridControl_RadGrid1_ctl00").editItem(editedRow); 
 
 } 
 } 

eventArgs.get_itemIndexHierarchical() is undefinied, so editedRow is undefined and everything crashed.

Where can be the problem?

edit: I found the problem, the eventArgs.get_itemIndexHierarchical() is set but the

$find("ctl00_masterdetail_MasterDetailControl_detailrecords_positionGridControl_RadGrid1_ctl00").editItem(editedRow); 





does nothing...

6 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 26 Jan 2010, 12:15 PM
Hi Adriane,

In order to achieve your goal, try getting the client object of the MasterTableView using the code snippet bellow:
JavaScript:
var master = $find('<%= RadGrid1.ClientID %>').get_masterTableView();

I hope this helps.

All the best,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Adriane
Top achievements
Rank 1
answered on 26 Jan 2010, 12:56 PM
Hello,

I am using:

$find("<%= RadGrid1.MasterTableView.ClientID %>").editItem(editedRow);

but it doesn't help so far...

Do I need to define a ClientID in my MasterTableView from RadGrid1 ?
0
Pavlina
Telerik team
answered on 26 Jan 2010, 05:12 PM
Hi Adriane,

I suggest you try the code snippet bellow in order to set the row in EditMode on clicking the row.
JavaScript:
<script type="text/javascript">  
    function OnRowClick(sender, eventArgs) {  
        editedRow = eventArgs.get_itemIndexHierarchical();  
        $find("<%= RadGrid1.MasterTableView.ClientID %>").editItem(editedRow);  
    }  
</script>

Give it a try and see if it works for you.

Sincerely yours,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Adriane
Top achievements
Rank 1
answered on 28 Jan 2010, 09:24 AM
Hello Pavlina,

yes that's the code I've been using all the time.
What do you mean by "Give it a try and see if it works for you." ?
Where is the difference?

0
Pavlina
Telerik team
answered on 02 Feb 2010, 03:08 PM
Hi Adriane,

Attached to this message is a simple working application which handles the desired functionality. Please examine it and see if it works for you or if I am leaving something out.

I hope this helps.

Best wishes,
Pavlina
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
p
Top achievements
Rank 1
answered on 03 Feb 2010, 04:02 PM


I have had a similar problem.

<code>          
function RowDblClick(sender, eventArgs) 
         { 
             editedRow = eventArgs.get_itemIndexHierarchical(); 
             $find("<%= RadGrid1.MasterTableView.ClientID %>").editItem(editedRow); 
         } 
</code> 

The above code didnt work for me because " RadGrid1.MasterTableView.ClientID" was null.

So i used their first suggestion and the code below worked.

            function RowDblClick(sender, eventArgs) { 
                editedRow = eventArgs.get_itemIndexHierarchical(); 
                var master = $find('<%= rgAPList.ClientID %>').get_masterTableView(); 
 
               // alert(master.id); 
                //$find('<%= rgAPList.MasterTableView.ClientID %>').editItem(editedRow); 
                master.editItem(editedRow); 
            } 




Tags
Grid
Asked by
Adriane
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Adriane
Top achievements
Rank 1
p
Top achievements
Rank 1
Share this question
or