2013-05-09 56 views
0

我有一个类型为text的gridview列。jquery:将字符串添加到gridview中的文本框

<sjg:gridColumn id="vName" name="variableName" index="variableName" title="Variable_Name" sortable="true" editable="true" edittype="text"/> 

我想追加一个字符串“C:\”到动态文本框内容。我该怎么做? 我尝试使用这个脚本,但它不工作

var myString="C:\"; 
$('#vName').append(myString); 
+1

您能否发表您尝试过的代码并无效? – 2013-05-09 07:21:33

+0

您可以发布您的HTML代码吗?我的意思是运行应用程序后生成的代码。 – 2013-05-09 07:59:03

回答

0

你可以简单地设置一个自定义格式功能:

里面列的colModel

.... 
    formatter: CustomFormatFunction, unformat: CustomUnFormatFunction}, 
    .... 

格式自定义功能:

function CustomFormatFunction(cellval, opts, rowObject, action) { 
    return "c:\" + cellval; 
} 

function CustomUnFormatFunction(cellval, opts, rowObject, action) { 
    return cellval; //or manipulate the string to remove the "c:\" 
} 
相关问题