内容复合组件[复制](Inner content composite component [duplicate])
我有我的复合组件
<my:panel/>
:<composite:interface> <composite:attribute name="header" /> <composite:attribute name="content" /> </composite:interface> <composite:implementation> <div class="panel panel-default"> <div class="panel-heading">#{cc.attrs.header}</div> <div class="panel-body"> #{cc.attrs.content} </div> </div> </composite:implementation>
我用过:
<my:panel header="My header" content="My content" />
那么,现在我想添加内容属性中的HTML(一个HTML表格)代码。 我怎么能这样做
<my:tag/>
作品?<my:tag header="My header" > <table style="width:100%"> <tr> <th>Firstname</th> <th>Lastname</th> <th>Age</th> </tr> </table> </my:tag>
This question already has an answer here:
I have my composite component
<my:panel/>
:<composite:interface> <composite:attribute name="header" /> <composite:attribute name="content" /> </composite:interface> <composite:implementation> <div class="panel panel-default"> <div class="panel-heading">#{cc.attrs.header}</div> <div class="panel-body"> #{cc.attrs.content} </div> </div> </composite:implementation>
And i used:
<my:panel header="My header" content="My content" />
Well, now i want to add html (a html table e.g.) code in content attribute. How could i do for
<my:tag/>
works like this?<my:tag header="My header" > <table style="width:100%"> <tr> <th>Firstname</th> <th>Lastname</th> <th>Age</th> </tr> </table> </my:tag>
原文:https://stackoverflow.com/questions/39863030
更新时间:2022-03-15 09:03
最满意答案
为了更好的参考,请看看::
如何将两个模型组合成一个模型,并使用asp.net MVC razor将其传递给视图
然后在服务器端的表单提交(即进入控制器的操作)保存来自视图的数据,如:: ::
public ActionResult Save(CommonViewModel common) { var FirstModel = new FirstModel(); FirstModel = common.FirstModel; db.Entry(FirstModel).State = EntityState.Added; var SecondModel = new SecondModel(); SecondModel = common.SecondModel; db.Entry(SecondModel).State = EntityState.Added; db.SaveChanges(); }
可能这个答案将有助于您的查询答案。
[HttpPost]
public ActionResult Edit(CompPeripheral cp, int c_id,int em_id,int asset_id) { if (ModelState.IsValid) { cp.Compconfig.c_id = c_id; cp.Compconfig.em_id = em_id; cp.Compconfig.asset_id = asset_id; db.tbl_compconfig.Add(cp.Compconfig); db.SaveChanges(); var id = db.tbl_compconfig.Max(a => a.comp_id); cp.Comperipheral.comp_id = id; //saving Comp Peripheral in database db.tbl_comperipheral.Add(cp.Comperipheral); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.asset_id = new SelectList(db.tbl_assetm, "asset_id", "asset_name", cp.Compconfig.asset_id); ViewBag.em_id = new SelectList(db.tbl_employee, "em_id", "em_fullname", cp.Compconfig.em_id); ViewBag.c_id = new SelectList(db.tbl_client, "c_id", "c_name", cp.Compconfig.c_id); return View(cp); }
相关问答
更多-
我想你真的想要一个UNION : SELECT * FROM newpancard WHERE status='done' UNION SELECT * FROM oldpancard WHERE status='done' 我们使用UNION (而不是UNION ALL ),因此我们不会从newpancard和oldpancard获取重复记录 输出(来自您的样本数据): id name cardno status 1 name1 909099 done 2 name2 800 ...
-
执行LEFT OUTER JOIN类的 select c.city, coalesce(h.history,''), coalesce(h.id,'') as history_id from city c left join history h on c.id = h.id; Perform a LEFT OUTER JOIN like select c.city, coalesce(h.history,''), coalesce(h.id,'') as history_id from city ...
-
如果我理解正确,那么你正在寻找一个左连接过滤器,即左连接Items (另外包含它用于检索),按Orders主键分组(以避免重复),然后只需添加Items.vessel_id条件到主查询WHERE子句,以使其成为OR条件。 $query ->contain('Items') ->leftJoinWith('Items') ->where([ 'OR' => [ 'Orders.id' => $freeText, // .. ...
-
使用sfWidgetFormDoctrineChoice从两个表中获取数据(Using sfWidgetFormDoctrineChoice to get data from two tables)[2022-02-05]
是的你应该使用sfWidgetFormChoice Yes you should use sfWidgetFormChoice -
select t1.id, t1.username, t2.key, t2.value from table1 t1 left join table2 t2 on t1.id = t2.user_id and t2.key = 'key1' 为了让你的“替代”得到所有不具备的东西,只需添加一个where子句。 where t2.user_id IS NULL select ...
-
为列名使用别名来区分团队表和玩家表中具有相同名称的列。 SELECT teams.id as team_id, teams.name as team_name, players.id, players.name, players.teamId FROM teams LEFT JOIN players ON teams.id = players.zoneId WHERE teamId = 3 然后你可以使用下面的来获取球队名称和球队ID: $row["team_name"] $row["team_id"] ...
-
你在这里提取食物,所以它会给出这样的数组 Array ( [0] => Array ( [FoodItem] => Array ( [id] => B102 [food_item_title] => Prown cocktail [active] => 1 ) ) ) 请删除$fooditems=Set::extract('/Foo ...
-
您需要使用一些常用列(最好是ID)加入它们。 我想INVENTARIO有一个外键给MATERIALS。 那是对的吗? 在这种情况下,它将是: select * from INVENTARIO inv, MATERIALS mat on inv.fk = mat.id 其中fk是MATERIALS ID的外键。 但这只是猜测,因为我们不知道你的表是怎样的。 这将是一个隐含的“交叉”连接。 有关其他可能性,请参阅http://en.wikipedia.org/wiki/Join_%28SQL%29 You n ...
-
从两个表中获取数据(Getting data from two tables)[2022-10-29]
为了更好的参考,请看看:: 如何将两个模型组合成一个模型,并使用asp.net MVC razor将其传递给视图 然后在服务器端的表单提交(即进入控制器的操作)保存来自视图的数据,如:: :: public ActionResult Save(CommonViewModel common) { var FirstModel = new FirstModel(); FirstModel = common.FirstModel; db.Entry(Firs ... -
您可以使用外连接执行此操作,但这将是不必要的复杂: select employeeId , count(*) as loginCount from ( select employeeId , loginTime from table1 where loginTime between '2017-01-01 00:00:00' and '2017-01-31 23:59:59' ...