2013-05-09 57 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:\" 
} 
相關問題