<label for="products">Products:</label> <?php $read->url('cascadingcombobox.php?type=products'); $transport->read($read); $products = new \Kendo\UI\ComboBox('products'); $products->dataSource(array('transport' => $transport, 'schema' => $schema, 'serverFiltering' => true))->autoBind(false)->cascadeFrom('categories')->dataTextField('ProductName')->dataValueField('ProductID')->attr('style', 'width:300px')->filter('contains')->placeholder('Select product ...'); echo $products->render(); ?> </p> <p> <label for="orders">Orders:</label> <?php $read->url('cascadingcombobox.php?type=orders'); $transport->read($read); $products = new \Kendo\UI\ComboBox('orders'); $products->dataSource(array('transport' => $transport, 'schema' => $schema, 'serverFiltering' => true))->autoBind(false)->cascadeFrom('products')->dataTextField('OrderID')->dataValueField('OrderID')->attr('style', 'width:300px')->filter('contains')->placeholder('Select order ...'); echo $products->render(); ?> </p> <button class="k-button" id="get">View Order</button> </div> <script> $(document).ready(function () { var categories = $("#categories").data("kendoComboBox"), products = $("#products").data("kendoComboBox"), orders = $("#orders").data("kendoComboBox"); $("#get").click(function () { var categoryInfo = "\nCategory: { id: " + categories.value() + ", name: " + categories.text() + " }", productInfo = "\nProduct: { id: " + products.value() + ", name: " + products.text() + " }", orderInfo = "\nOrder: { id: " + orders.value() + ", name: " + orders.text() + " }";
<div id="tshirt-view" class="k-header"> <h2>Customize your Kendo T-shirt</h2> <img id="tshirt" src="../content/web/combobox/tShirt.png" /> <div id="options"> <h3>T-shirt Fabric</h3> <?php $fabrics = new \Kendo\Data\DataSource(); $fabrics->data(array(array('text' => 'Cotton', 'value' => 1), array('text' => 'Polyester', 'value' => 2), array('text' => 'Cotton/Polyester', 'value' => 3), array('text' => 'Rib Knit', 'value' => 4))); $input = new \Kendo\UI\ComboBox('fabric'); $input->dataSource($fabrics)->dataTextField('text')->dataValueField('value')->filter('contains')->placeholder('Select fabric ...')->suggest(true)->index(3); echo $input->render(); ?> <h3>T-shirt Size</h3> <?php $select = new \Kendo\UI\ComboBox('size'); $select->dataSource(array('X-Small', 'Small', 'Medium', 'Large', 'X-Large', '2X-Large'))->placeholder('Select size ...')->index(0); echo $select->render(); ?> <button class="k-button" id="get">Customize</button> </div> </div> <style scoped> #example h2 { font-weight: normal; } #tshirt-view { border-radius: 10px 10px 10px 10px; border-style: solid; border-width: 1px; overflow: hidden; width: 500px;
echo json_encode($result->read('Products', array('ProductID', 'ProductName'), $request)); exit; } require_once '../include/header.php'; $transport = new \Kendo\Data\DataSourceTransport(); $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('serverfiltering.php')->contentType('application/json')->type('POST'); $transport->read($read)->parameterMap('function(data) { return kendo.stringify(data); }'); $schema = new \Kendo\Data\DataSourceSchema(); $schema->data('data')->total('total'); $dataSource = new \Kendo\Data\DataSource(); $dataSource->transport($transport)->schema($schema)->serverFiltering(true); $comboBox = new \Kendo\UI\ComboBox('products'); $comboBox->dataSource($dataSource)->dataTextField('ProductName')->dataValueField('ProductID')->filter('contains')->ignoreCase(false)->attr('style', 'width:250px'); ?> <div class="demo-section"> <h2>Products</h2> <?php echo $comboBox->render(); ?> </div> <style scoped> .demo-section { width: 250px; margin: 35px auto 50px; padding: 30px; } .demo-section h2 {