使用ICEfaces来表示ajax行为(Primefaces ajax behaviour vs ICEfaces)
我是JSF的新手,ICEfaces是我使用的第一个组件库。 使用ICEfaces,如果我使用
commandButton
action
通过支持bean更改inputText
值,那些更改只会反映到UI。但是使用Primefaces,我必须明确提到应该使用
commandButton
update
属性更新哪个组件。这是预期的行为吗? 如果是这样,JSF有标准吗?
I'm new to JSF and ICEfaces is the first component library I used. With ICEfaces, If I change an
inputText
value via backing bean usingcommandButton
action
, those changes just reflect to the UI.But with Primefaces I have to mention explicitly what component should be updated using
update
attribute of thecommandButton
.Is this the expected behavior ? If so, is there a standard for JSF ?
原文:https://stackoverflow.com/questions/17057774
最满意答案
这是一个经典的
dcast
操作,增加了复杂性,你需要填充原始数据,你可以使用合并:dcast( DT[CJ(rank_year = as.character(-19:1), id = id, unique = TRUE), on = c("rank_year", "id")], id ~ rank_year, value.var = "sales") # id -1 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -2 -3 -4 -5 -6 -7 -8 -9 0 1 #1: 1 150 NA NA NA NA NA NA NA NA NA NA 151 152 155 NA NA NA NA NA 149 NA #2: 2 NA NA NA NA NA NA NA NA NA NA NA 83 80 81 97 NA NA NA NA 84 NA
请注意,排序是字母顺序,因为您的
rank_year
是一个字符向量。 如果需要数字排序,请将其设为整数。 或者您可以在之后订购列。 此外,您不应将NA
值定义为字符。This is a classic
dcast
operation with the added complication that you need to pad the original data, which you can do with a merge:dcast( DT[CJ(rank_year = as.character(-19:1), id = id, unique = TRUE), on = c("rank_year", "id")], id ~ rank_year, value.var = "sales") # id -1 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -2 -3 -4 -5 -6 -7 -8 -9 0 1 #1: 1 150 NA NA NA NA NA NA NA NA NA NA 151 152 155 NA NA NA NA NA 149 NA #2: 2 NA NA NA NA NA NA NA NA NA NA NA 83 80 81 97 NA NA NA NA 84 NA
Note that the ordering is alphabetic because your
rank_year
is a character vector. Make it an integer if you need numeric sorting. Or you could just order the columns afterwards. Also, you should not defineNA
values as characters.
相关问答
更多-
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
有点复杂,但它的工作原理。 仅使用R base。 从这个问题采取以简单方式比较多列的形式。 sum(df[df$S1==df$S3 & rowSums(sapply(df[,c(3,5,6)],`==`,e2=df$S1)) == 0,1]) [1] 11 最复杂的部分是如何检查多列。 在这种情况下,我们使用sapply将列c(3,5,6)与等式( '==' )与S1进行比较,( e2是==函数的第二个参数)。 正如ycw所提到的,通过向量定义所有列可能有点复杂,因此这种形式允许您检查除我们不想要的列之 ...
-
我们可以在对象'a'之前使用双点( .. )来提取列 dt[, ..a] # col4 col5 col6 #1: 4 5 6 #2: 5 6 7 #3: 6 7 8 #4: 7 8 9 或者另一个选项是with = FALSE dt[, a, with = FALSE] 数据 dt <- data.table(col1 = 1:4, col2 = 2:5, col3 = 3:6, col4 = 4:7, col5 = 5:8, ...
-
快速从表中提取列并在R中为它们提供特定格式(Fast way to extract columns from table and give them a specific format in R)[2023-10-31]
这是一个经典的dcast操作,增加了复杂性,你需要填充原始数据,你可以使用合并: dcast( DT[CJ(rank_year = as.character(-19:1), id = id, unique = TRUE), on = c("rank_year", "id")], id ~ rank_year, value.var = "sales") # id -1 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -2 -3 -4 -5 -6 -7 ... -
我不是100%肯定你想要什么,但这可能会对你有所帮助。 A <- "do 50% and whatever 23" B <- gregexpr("\\d+",A)[[1]] firstNum <- substr(A,B[1],B[1]+attr(B,"match.length")[1]-1) secondNum <- substr(A,B[2],B[2]+attr(B,"match.length")[2]-1) 希望这可以帮助。 I am not 100% sure about what you want ...
-
通过R中的dplyr将特定的列对收集到行中(Gathering specific pairs of columns into rows by dplyr in R [duplicate])[2023-08-20]
这不是很大的可扩展性,所以如果你最终需要超过这3对列,请使用@ akrun的答案。 我只想指出,您包含的bind_rows片段实际上可以在一个管道中完成: library(tidyverse) bind_rows( df %>% select(id, var, a = a1, b = b1), df %>% select(id, var, a = a2, b = b2), df %>% select(id, var, a = a3, b = b3) ... -
从PostgreSQL表中提取特定列并对其值进行更新(Extract specific Columns from PostgreSQL table and Do an update on its values)[2023-07-31]
在你的功能中你需要使用动态命令 。 funcion format()通常非常有用。 示例数据: create table my_table(col1_suffix text, col2_suffix text, col3_suffix text); insert into my_table values ('a', 'b', 'c'); 功能示例: CREATE OR REPLACE FUNCTION update_my_table() RETURNS void AS $BODY$ DECLARE r ... -
OP在'table'中使用'exp'列获得不同列的原因是exp的class 。 它将是factor类,因此转换为character是一种选择。 means[,as.character(table$exp)] factor被强制转换为整数,我们得到 as.integer(factor(table$exp)) #[1] 1 2 means[,factor(table$exp)] # as er #a 34.66667 3.5 #b 22.66667 4.5 #c 5.00000 7.5 # ...
-
如何在R中提取特定行?(How to extract specific rows in R?)[2023-11-02]
一个dplyr解决方案:计算每个家庭的独特城市的长度,并仅保留长度> 1的城市 library(dplyr) df <- data.frame(city=c("Paris","Paris","Nice","Limoge","Limoge","Toulouse","Paris"), household =c(rep("A",3),rep("B",2),rep("C",2))) new_df <- df %>% group_by(household) %>% filter ... -
这将产生你需要的东西: library(jsonlite) ID=c(100,110,200) Title=c("aa","bb","cc") df <- data.frame(ID, Title) more=data.frame(Interesting=c("yes","no","yes"),new=c("no","yes","yes"),original=c("yes","yes","no")) df$more <- more toJSON(df) 输出: [{ "ID": 10 ...