sap.ui.table table row selecter disable in sapui5 -
is possible disable row selector particular rows. setenable method not available sap.ui.table. please kindly me on this. please find attached screenshot better understanding.
thanks & regards, hemachandran.r
please go through following code. might you.
sap.ui.controller("my.controller", { oninit: function() { var model = new sap.ui.model.json.jsonmodel([ {product: "power projector 4713", weight: "33"}, {product: "gladiator mx", weight: "33"}, {product: "hurricane gx", weight: "45"}, {product: "webcam", weight: "33"}, {product: "monitor locking cable", weight: "41"}, {product: "laptop case", weight: "64"} ]); var vw = this.getview(); vw.setmodel(model); // disable checkboxes var tbl = vw.byid('tblproduct'); tbl.adddelegate({ onafterrendering: function() { var header = this.$().find('thead'); var selectallcb = header.find('.sapmcb'); selectallcb.remove(); this.getitems().foreach(function(r) { var obj = r.getbindingcontext().getobject(); var enabled = parseint(obj.weight, 10) > 40; var cb = r.$().find('.sapmcb'); var ocb = sap.ui.getcore().byid(cb.attr('id')); ocb.setenabled(enabled); }); } }, tbl); } }); var oview = sap.ui.xmlview({ viewcontent: jquery('#chartview').html() }).placeat('content');
<!doctype html> <html> <head> <meta charset="utf-8"> <title>js bin</title> <script src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js" id="sap-ui-bootstrap" data-sap-ui-theme="sap_bluecrystal" data-sap-ui-xx-bindingsyntax="complex" data-sap-ui-libs="sap.m"></script> <script id="chartview" type="sapui5/xmlview"> <mvc:view controllername="my.controller" xmlns:l="sap.ui.layout" xmlns:u="sap.ui.unified" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" class="viewpadding"> <app> <pages> <page title="table checkbox disable" class="marginboxcontent" > <content> <table id="tblproduct" mode= "multiselect" selectionchange = "rowselect" items="{/}"> <columns> <column> <label text="product" /> </column> <column> <label text="weight" /> </column> </columns> <items> <columnlistitem> <cells> <text text="{product}" /> <text text="{weight}" /> </cells> </columnlistitem> </items> </table> </content> </page> </pages> </app> </mvc:view> </script> </head> <body class="sapuibody"> <div id='content'></div> </body> </html>
regards, farooq.
Comments
Post a Comment