こんにちは私はSharepointで1つのasp.net javascriptアプリケーションを開発しています。 2ページあります。最初のページはdefault.aspxです。私は編集ボタンを持つ1つのgridviewを持っています。編集ボタンをクリックするたびに、addnewitem.aspxページにリダイレクトします。私が編集をクリックするたびに、クエリーストリングで現在の行データをaddnewitem.aspxに送信したい。私は以下のように努力しています。しかし、私のページは爽やかで、addnewitem.aspxへのリダイレクトはしません。ボタンクリックで他のページにデータを送信できないのですか?
以下は私のgridviewコードです。私はデータを取得しています。
function readAll() {
var clientContext;
clientContext = SP.ClientContext.get_current();
var oList = clientContext.get_web().get_lists().getByTitle('Requisition');
var query = new SP.CamlQuery();
query.set_viewXml('<View><RowLimit></RowLimit>10</View>');
var items = oList.getItems(query);
clientContext.load(oList);
clientContext.load(items);
var table = $("#addtable");
var innerHtml = "<tr><th>ID</th><th>Title</th><th>PrimarySkills</th><th>SecondarySkills</th><th>Vacanies</th><th>JobSummary</th><th>JobDescription</th><th>Experience_x0028_Yrs_x0029_</th><th>Qualification</th><th>m</th><th>Customer</th><th>RecievedDate</th><th>TargetDate</th><th>Comments1</th><th>Division</th><th>Actions</th></tr>";
clientContext.executeQueryAsync(
Function.createDelegate(this, function() {
var itemInfo = '';
var enumerator = items.getEnumerator();
while (enumerator.moveNext()) {
var currentListItem = enumerator.get_current();
innerHtml += "<tr><td>" + currentListItem.get_item('ID') + "</td><td>" + currentListItem.get_item('Title') + "</td><td>" + currentListItem.get_item('PrimarySkills') + "</td><td>" + currentListItem.get_item('SecondarySkills') +"</td><td scope='col'><button class='btn btn-primary btn-cons blue' id='Edit'>Edit</button></td></tr>";
}
table.html(innerHtml);
}),
Function.createDelegate(this, fail)
);
function success() {
$("#dvMessage").text("Operation Completed Successfully");
}
function fail() {
$("#dvMessage").text("Operation failed " + arguments[1].get_message());
}
}
上記のコードでは、[編集]ボタンがリロードされます。私は他のページにリダイレクトしたかったのです。これは起こっていない。 document.location.href = url;これはリダイレクトする正しい方法ですか?
これは私の編集ボタンコードです。
$('#addtable td:nth-child(4)').bind('click', function() {
alert("Clicked");
var Title = $(this).closest("tr").children().eq(0).html();
var PrimarySkills = $(this).closest("tr").children().eq(1).html();
var SecondarySkills = $(this).closest("tr").children().eq(2).html();
var url = 'http://sites/APPSTEST/JobRequisitionApp/Pages/AddNewItem.aspx?Title=' + encodeURIComponent(Title) + 'PrimarySkills=' + encodeURIComponent(PrimarySkills) + 'SecondarySkills=' + encodeURIComponent(SecondarySkills);
document.location.href = url;
});
誰かがこれを達成するために私を導くことができますか?皆さん、ありがとうございました。
window.locationは文書化された方法ですが、document.location.hrefは読み込み専用になっていても動作するはずです – mplungjan