Tuesday, 15 July 2014

javascript - RadGrid client binding get_masterTableView() is null -



javascript - RadGrid client binding get_masterTableView() is null -

i setting datasource @ client side get_mastertableview returns null

var tableview = radgrid .get_mastertableview();

i tried setting on button click sure radgrid created still returns null.. code

<h4>client side binding</h4> <telerik:radbutton id="radbutton1" autopostback="false" onclientclicked="radbutton1_onclientclicked" runat="server" text="load items"></telerik:radbutton> <telerik:radgrid id="radgrid1" autogeneratecolumns="false" runat="server"> <mastertableview> <columns> <telerik:gridboundcolumn datafield="name" headertext="name"> </telerik:gridboundcolumn> <telerik:gridboundcolumn datafield="age" headertext="age"> </telerik:gridboundcolumn> <telerik:gridboundcolumn datafield="address.city" headertext="city"> </telerik:gridboundcolumn> </columns> </mastertableview> <clientsettings> <clientevents ongridcreated="radgrid1_ongridcreated" /> </clientsettings> </telerik:radgrid>

and on javascript

<telerik:radscriptblock runat="server"> <script> function pageload(sender, args) { //rebindgrid(); } function radbutton1_onclientclicked(sender, args) { rebindgrid(); } function radgrid1_ongridcreated(sender, args) { //rebindgrid(); } function rebindgrid() { var ds = datasource(); var radgrid = $find('<%= radgrid1.clientid %>'); var tableview = radgrid .get_mastertableview(); console.log(radgrid); if (tableview) { tableview.set_datasource(ds); tableview.databind(); tableview.set_virtualitemcount(2); } else { alert('table view null'); } } function datasource() { var items = []; items.push({ name: 'enteng', age: 25, address: { city: 'dipolog city' } }); items.push({ name: 'vincent', age: 27, address: { city: 'dumaguete city' } }); homecoming items; } </script> </telerik:radscriptblock>

pageload doesn't work

radbutton1_onclientclicked doesn't work

radgrid1_ongridcreated doesn't work

any help appreciated..

tyi

ongridcreated should work. think there bug in code:

this:

var radgrid = $find('<%= radgrid1.clientid %>');

should like:

var radgrid = $find('#<%= radgrid1.clientid %>');

alternatively can utilize sender argument handle on radgrid:

function radgrid1_ongridcreated(sender, args) { rebindgrid(sender); } function rebindgrid(sender) { var tableview = sender.get_mastertableview(); ... etc

edit:

as stated in comment below problem the radgird not bound info source. get_mastertableview() returns null.

the next piece of code, binds grid dummy info source, solves problem:

protected void page_load(object sender, eventargs e) { radgrid1.datasource = new list<int>(); }

javascript asp.net telerik telerik-grid

1 comment:

  1. Breedlove: Javascript - Radgrid Client Binding Get_Mastertableview() Is Null - >>>>> Download Now

    >>>>> Download Full

    Breedlove: Javascript - Radgrid Client Binding Get_Mastertableview() Is Null - >>>>> Download LINK

    >>>>> Download Now

    Breedlove: Javascript - Radgrid Client Binding Get_Mastertableview() Is Null - >>>>> Download Full

    >>>>> Download LINK A0

    ReplyDelete