Hi,
I want to develop grid with javascript without framework , and I need some help in order to retrieve all record and print it with concat (pagination)
this is my code :
<head>
<meta>
<title>Hello, Bootstrap Table!</title>
<link src="">maxcdn.bootstrapcdn.com/.../bootstrap.min.css" rel="stylesheet">
<link src="">cdnjs.cloudflare.com/.../font-awesome.css" rel="stylesheet">
<style type="text/css">
.content-info {
background: #f9f9f9;
padding: 40px 0;
background-size: cover!important;
background-position: top center!important;
background-repeat: no-repeat!important;
position: relative;
padding-bottom:100px;
}
table {
width: 100%;
background: #fff;
border: 1px solid #dedede;
}
table thead tr th {
padding: 20px;
border: 1px solid #dedede;
color: #000;
}
table.table-striped tbody tr:nth-of-type(odd) {
background: #f9f9f9;
}
table.result-point tr td.number {
width: 100px;
position: relative;
}
.text-left {
text-align: left!important;
}
table tr td {
padding: 10px 20px;
border: 1px solid #dedede;
}
table.result-point tr td .fa.fa-caret-up {
color: green;
}
table.result-point tr td .fa {
font-size: 20px;
position: absolute;
right: 20px;
}
table tr td {
padding: 10px 40px;
border: 1px solid #dedede;
}
table tr td img {
max-width: 32px;
float: left;
margin-right: 11px;
margin-top: 1px;
border: 1px solid #dedede;
}
</style>
</head>
<body>
<script>
document.onreadystatechange = function () {
if (document.readyState === "complete") {
testFXML();
}
};
var fxml = ["<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>"
, "<entity name='account'>"
, "<attribute name='name' />"
, "<attribute name='adress' />"
, " <attribute name='age' />"
, "</entity>"
, "</fetch>"].join();
fxml = "?fetchXml=" + encodeURIComponent(fxml);
var testFXML = function () {
parent.Xrm.WebApi.retrieveMultipleRecords("account", fxml, 3).then(
function (resp) {
if (resp != null && resp.entities.length > 0) {
const tb = document.getElementById("tb");
let tr = [];
resp.entities.forEach(item => {
tr.push('<tr><td>' + item.name + '</td>')
tr.push('<td>' + item.adress + '</td>')
tr.push('<td>' + item.age + '</td>')
})
tb.innerHTML = tr.join("");
document.getElementById("result").classList.remove("hide"); // show
//I don't know how to retrieve this url and use it for my others request and next page
console.log("Paging cookie: " + resp.fetchXmlPagingCookie);
}
}
);
}
</script>
<input type="button" onclick="testFXML()" value="some entities testFXML" accesskey="s">
<section class="content-info">
<div class="container paddings-mini">
<div class="row">
<div id="result" class="col-lg-12">
<table class="table-striped table-responsive table-hover result-point">
<thead class="point-table-head">
<tr class="bg-light">
<th>name</th>
<th>adress</th>
<th>age</th>
</tr>
</thead>
<tbody id="tb"></tbody>
</table>
</div>
</div>
</div>
</section>
<script charset="utf8" src="">stackpath.bootstrapcdn.com/.../script>
<script charset="utf8" src="">cdnjs.cloudflare.com/.../script>
</body>
</html>