// form/nc/blog/blog.js

if (!rec.content) {
	// on first load
	update()
}

function update() {
	// area, rowIndex, event
	// area = 'article_blog'
	const call = {}
	call.name = 'form/nc/blog/grid.json'
	/* call.return = {
		grid: [{ name: area, tab: tabValue(area) }]
	} */
	nc.callServer(state, 'query', call, gridRowClicked(0))
}

function gridRowClicked(rowIndex) {
	const grid = state.grid
	if (rowIndex >= 0 && grid.article_blog && grid.article_blog.data && grid.article_blog.data[rowIndex - 1]) {
		rec.content = grid.article_blog.data[rowIndex - 1].content
	} else {
		rec.content = ''
	}
}
