Skip to navigation
Set a header of a free-jqgrid title from an api ajax call
15.10.20
async function set_title() { const url = "https://foo.com/api" jQuery( ".ui-jqgrid-htable .ui-th-column div" ).each( async function( i ) { let id = this.id.split('jqgh_grid_'); if(id.length > 1) { let abbrev = id[1]; let term = abbrev; let r = JSON.parse(await aget_api(url +"?name="+abbrev)); if(r['data']['term']) { term = r['data']['term']; } jQuery(this).attr("title",term); } }); } async function aget_api(url) { return new Promise((resolve, reject) => { let xhr = new XMLHttpRequest(); xhr.open("GET", url,true); xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhr.onload = function() { return resolve(xhr.responseText); }; xhr.onerror = function() { return reject(xhr.statusText); }; xhr.send(null); }); }
https://free-jqgrid.github.io/
Reply
Anonymous
Information Epoch 1732573885
Portable data is as important as portable code.
Home
Notebook
Contact us