jqGrid有一个名为Posted的列.根据客户如何配置网格,它可以定位在不同的位置,但始终保持不变.
如果已发布列的值为True,我需要更改行的背景颜色
我在下面尝试了colmodel但是alert(rdata.Posted)显示总是未定义.
如果此行中的已发布列的值为true,如何更改行的背景颜色?
我查看了许多Oleg和其他改变背景颜色的解决方案,但他们使用的是硬编码列号.
colModel: [
{"cellattr":function(rowId, tv, rawObject, cm, rdata) {
if (rdata.Posted)
return 'class="jqgrid-readonlycolumn"';
return '';
}
,"label":"Klient","name":"Klient_nimi","classes":null,"hidden":false},
{"label":null,"name":"Posted","editable":true,"width":0,
"classes":null,"hidden":true}],
...
Run Code Online (Sandbox Code Playgroud)
更新
在update2中,Oleg建议使用rowattr.我还需要在操作列中隐藏内联删除按钮和自定义发布按钮.我在loadComplete下面是usijng代码.如何使用rowattr实现这一点?
var LoadCompleteHandler = function () {
var iCol = getColumnIndexByName($grid, 'Kinnitatud'),
postedDateCol = getColumnIndexByName($grid, 'Kinkuup'),
cRows = $grid[0].rows.length,
iRow,
row,
className,
isPosted,
mycell,
mycelldata,
i, count,
cm = $grid.jqGrid('getGridParam', 'colModel'),
l,
iActionsCol = getColumnIndexByName($grid, '_actions');
l = cm.length;
if (iCol > 0 || postedDateCol > 0) {
for (iRow = 0; iRow < cRows; …Run Code Online (Sandbox Code Playgroud) 如果满足某些条件,如何从PostgreSQL SQL语句中引发错误?
我试过下面的代码,但得到了错误.
CREATE OR REPLACE FUNCTION "exec"(text)
RETURNS text AS
$BODY$
BEGIN
EXECUTE $1;
RETURN $1;
END;
$BODY$
LANGUAGE plpgsql VOLATILE;
-- ERROR: syntax error at or near "raise"
-- LINE 1: raise 'test'
SELECT exec('raise ''test'' ') WHERE TRUE
Run Code Online (Sandbox Code Playgroud)
在实际应用TRUE中被某些条件所取代.
更新
我试图扩展答案以传递异常消息参数.尝试下面的代码,但语法错误.如何传递消息参数?
CREATE OR REPLACE FUNCTION exec(text, variadic )
RETURNS void LANGUAGE plpgsql AS
$BODY$
BEGIN
RAISE EXCEPTION $1, $2;
END;
$BODY$;
SELECT exec('Exception Param1=% Param2=%', 'param1', 2 );
Run Code Online (Sandbox Code Playgroud) 订单输入表单包含多行中的产品代码和数量列,并在每行末尾包含删除按钮( - ).它还包含第一列和表单后面的添加按钮.
按enter键应将焦点设置为下一个文本或数字输入字段(产品代码或数量),跳过按钮.
我尝试使用下面的代码,但输入密钥被忽略.
Chrome调试器显示该行$(this).next('input').focus()已执行但focus()调用没有任何效果.
使用jquery,jquery-mobile,ASP.NET MVC4
<!DOCTYPE html>
<html>
<head>
<script src="/Scripts/jquery/jquery-1.9.1.js"></script>
</head>
<body>
<div data-role="page" data-theme="a">
<div data-role="content">
<script>
$(function () {
$('#inputform').on('keydown', 'input', function (event) {
if (event.which == 13) {
$(this).next('input').focus();
event.preventDefault();
}
});
});
</script>
<form id='inputform' method="post"
action ="/Detail/SaveFullDocument?_entity=DokG&_id=0">
<fieldset>
<div class='form-field' >
<label class='form-label' for='Tasudok'>Order number</label>
<input class='ui-widget-content ui-corner-all form-fullwidth' id='Tasudok' name='Tasudok' value='' maxlength='25' /></div>
<input type="hidden" name="_rows" />
<table id="tableId">
<tr>
<th>Product code</th>
<th>Quantity</th>
<td>
<input type="button" value="+" onclick="addRow('tableId')" …Run Code Online (Sandbox Code Playgroud) ASP.NET MVC4应用程序包含包含Razor帮助程序的App_Code文件夹中的Helper.chtml文件.升级到Visual Studio Communitity版本后编译错误
Error CS0234 The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?) C:\Users\user\AppData\Local\Temp\Temporary ASP.NET Files\admin\e209c0e0\c74032ba\Sources_App_Code\helper.cshtml.72cecc2a.cs 16
Run Code Online (Sandbox Code Playgroud)
开始发生.生成的代码包含:
namespace ASP {
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq; // Error occurs in this line
using System.Net;
using System.Web;
using System.Web.Helpers;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using System.Web.WebPages.Html;
#line 1 "C:\Web\Erp\App_Code\Helper.cshtml"
using System.Web.Mvc;
#line default
#line hidden
#line 2 "C:\Web\Erp\App_Code\Helper.cshtml"
using System.Threading;
#line default
#line hidden
#line …Run Code Online (Sandbox Code Playgroud) asp.net-mvc visual-studio razor razor-declarative-helpers asp.net-mvc-4
列包含长行多行文本,使行高太大.
我根据Tony的回答在http://www.trirand.com/blog/?page_id=393/help/possible-row-height-bug-in-in-ie8/尝试了以下款式
但是那些不限制行最大高度:行高仍然等于列中的行数.
如何将行的最大高度限制为某个值?文本不应该换行(因为它已经使用jqGrid默认设置),并且不应显示剩余的行.(如果使用edittype textarea,则可以在编辑模式下检查整个文本).
jqgrid tr.jqgrow td {
max-height : 100px;
}
ui-jqgrid tr.jqgrow td {
max-height : 100px;
}
td {
max-height : 100px;
}
tr {
max-height : 100px;
}
Run Code Online (Sandbox Code Playgroud) 使用下面的代码在ASP.NET MVC2中实现输出缓存.
GetVaryByCustomString不调用方法:将断点放在第一行,运行应用程序显示未到达断点.达到控制器Index()中的断点.
如何VaryByCustom 在ASP.NET MVC2中使用?
控制器:
[OutputCache(VaryByCustom = "user")]
public ActionResult Index(string _entity, string id)
{
...
Run Code Online (Sandbox Code Playgroud)
的Global.asax.cs:
public class MvcApplication : System.Web.HttpApplication
{
public override string GetVaryByCustomString(HttpContext context, string arg)
{
if (arg == "user")
{
HttpCookie cookie = context.Request.Cookies["Company"];
if (cookie != null)
return Thread.CurrentPrincipal.Identity.Name + "," + cookie.Value;
return Thread.CurrentPrincipal.Identity.Name;
}
return base.GetVaryByCustomString(context, arg);
}
}
Run Code Online (Sandbox Code Playgroud) jqGrid参数loadonce:使用true
选择行并按删除按钮
没有设置网址
如何仅删除本地数据中的行并禁止显示此错误消息?是否可以设置一些虚拟URL或任何其他想法以允许行删除?如果添加和编辑表单也可以与本地数据一起使用,那将是很好的.
url: 'GetData',
datatype: "json",
multiselect: true,
multiboxonly: true,
scrollingRows : true,
autoencode: true,
loadonce: true,
prmNames: {id:"_rowid", oper: "_oper" },
rowTotal: 999999999,
rownumbers: true,
rowNum: 999999999,
Run Code Online (Sandbox Code Playgroud)
更新1
从Oleg回答我理解以下解决方案:
从此按钮单击提供的事件调用
grid.jqGrid('delGridRow',rowid,myDelOptions);
方法.可以选择多行.如何删除所有选定的行,此示例只删除一个?
更改jqGrid是否更好,以便删除,编辑,添加按钮无需网址?目前,需要传递虚拟URL,该URL始终为本地数据编辑返回成功.
我正在寻找一种方法来创建工具栏按钮uisng jquery ui.
我尝试使用创建按钮
<div id='menubar_home' style='vertical-align: middle;width: 20px; height: 20px;'>
</div>
Run Code Online (Sandbox Code Playgroud)
和使用
$('#menubar_home').button({
icons: { primary: "ui-icon-home" }
});
Run Code Online (Sandbox Code Playgroud)
但按钮中的图像不居中:

如何将图像置于按钮中心?
如果再次打开网格或刷新页面,如何预先确定当前行?
持久化jqGrid列首选项中的答案描述了如何保持列宽和其他一些参数.
在这个答案演示中,我点击了一行并按了F5.之前单击的行未突出显示.如何在本地存储中保存/恢复当前行?
更新
如果在应用程序中修改了jqGrid列结构,并且用户再次从浏览器打开应用程序,则restorecolumnstate会创建无效的colmodel,其中缺少某些元素.这会导致refreshSearchingToolbar中出现异常,该异常假定存在所有colmodel元素.
如何解决这个问题?在这种情况下如何设计修改后的colmodol而不是恢复colmodel?或者应该restoreColumnState更新colModel以便创建正确的数组?
**更新2**
如果myColumnsState.permutation包含空值,则$grid.jqGrid("remapColumns", myColumnsState.permutation, true)创建无效的colmodel.以下是在remapColumns调用之前和之后立即从VS调试器截取的屏幕截图
后:

我通过chaning代码来解决这个问题
if (isColState && myColumnsState.permutation.length > 0) {
var i, isnull = false;
for (i = 0; i < myColumnsState.permutation.length; i = i + 1) {
if (myColumnsState.permutation[i] == null) {
isnull = true;
break;
}
}
if (!isnull) {
$grid.jqGrid("remapColumns", myColumnsState.permutation, true);
}
Run Code Online (Sandbox Code Playgroud)
这是最佳解决方案吗?
如何在Postgres 9.0+中以Windows格式创建GUID?
我试过功能
CREATE or REPLACE FUNCTION public.getguid() RETURNS varchar AS $BODY$
DECLARE
v_seed_value varchar(32);
BEGIN
select
md5(
inet_client_addr()::varchar ||
timeofday() ||
inet_server_addr()::varchar ||
to_hex(inet_client_port())
)
into v_seed_value;
return (substr(v_seed_value,1,8) || '-' ||
substr(v_seed_value,9,4) || '-' ||
substr(v_seed_value,13,4) || '-' ||
substr(v_seed_value,17,4) || '-' ||
substr(v_seed_value,21,12));
END; $BODY$ LANGUAGE 'plpgsql' VOLATILE SECURITY DEFINER;
Run Code Online (Sandbox Code Playgroud)
从
http://postgresql.1045698.n5.nabble.com/newid-in-postgres-td1879346.html
试着
select getguid()
union all
select getguid()
Run Code Online (Sandbox Code Playgroud)
但它返回相同的值
"c41121ed-b6fb-c9a6-bc9b-574c82929e7e"
"c41121ed-b6fb-c9a6-bc9b-574c82929e7e"
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题,以便返回唯一的行?
jqgrid ×4
asp.net-mvc ×2
javascript ×2
plpgsql ×2
postgresql ×2
button ×1
c# ×1
css ×1
guid ×1
html ×1
html5 ×1
image ×1
jquery ×1
jquery-ui ×1
outputcache ×1
razor ×1