kendo ui - master detail with combobox and a grid -


i use combobox , grid telerik kendoui php , trying make master detail relation when current selected item change in combobox grid update current data.

here combobox code:

$combobox = new \kendo\ui\combobox('combobox');  $combobox->datatextfield('text')          ->datavaluefield('value')          ->datasource(array(             array('text' => 'item 1', 'value' => '1'),             array('text' => 'item 2', 'value' => '2'),             array('text' => 'item 3', 'value' => '3')          ))          ->change('onchange'); ?> <div class="demo-section">     <h3 class="title">combobox     </h3> <?php echo $combobox->render(); ?> </div>  <script> function onchange() {  } </script> 

the grid used standard 1 data php file return data in json format.

should use onchange() event update grid ? example ? dont have use code.

i think onchange approach idea. if have json data file in variable can filter data down in event of change combobox , manually set data on details grid. like:

function onchange(e){      var selectedcomboboxvalue = this.value();      var griddata = $.grep(myjsondata, function(item){         // filter down json down using jquery's grep method myjsondata representing variable holing json array php file.         // change equality check use whatever property appropriate.         return item.value == selectedcomboboxvalue;     });      // grab reference grid. modify selector needed.     var grid = $("#grid").data("kendogrid");      // pass in filtered data refresh grid.     grid.datasource.data(griddata); } 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -