# Wijmo_Grid_Cellmaker.Cellmaker

## Content

<div class="content__tsd">
						<div style="display:flex;justify-content:space-between;align-items:center">
							<h1>
								CellMaker Class
							</h1>
						</div>
						<section class="tsd-comment">
							<div class="tsd-comment">
								<div class="lead">
									<p>Provides methods for creating cells with custom content such as
									Buttons, Hyperlinks, Images, Ratings, and Sparklines.</p>
								</div>
								<p>To use these methods, assign their result to a column's
								<a href="wijmo_grid.column.html#celltemplate">Column.cellTemplate</a> property.</p>
							</div>
						</section>
						<section class="tsd-hierarchy">
							<h3>Heirarchy</h3>
							<ul class="tsd-hierarchy">
								<li>
									<span class="target">CellMaker</span>
								</li>
							</ul>
						</section>
						<section class="tsd-index-group">
							<section class="tsd-index-panel">
								<div class="tsd-index-content">
									<section class="tsd-index-section ">
										<div class="title">
											<div class="gc_api_tree-item_icon_img_wrapper">
												<div class="gc_api_tree-item_icon_img" data-expand="true">
												</div>
											</div>
											<h3>
												Methods
											</h3>
										</div>
										<ul class="tsd-index-list">
											<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="wijmo_grid_cellmaker.cellmaker.html#makebutton" class="tsd-kind-icon">make<wbr>Button</a></li>
											<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="wijmo_grid_cellmaker.cellmaker.html#makeimage" class="tsd-kind-icon">make<wbr>Image</a></li>
											<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="wijmo_grid_cellmaker.cellmaker.html#makelink" class="tsd-kind-icon">make<wbr>Link</a></li>
											<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="wijmo_grid_cellmaker.cellmaker.html#makerating" class="tsd-kind-icon">make<wbr>Rating</a></li>
											<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="wijmo_grid_cellmaker.cellmaker.html#makesparkline" class="tsd-kind-icon">make<wbr>Sparkline</a></li>
										</ul>
									</section>
								</div>
							</section>
						</section>
						<section class="tsd-panel-group tsd-member-group ">
							<h2>Methods</h2>
							<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static">
								<a name="makebutton" class="tsd-anchor"></a>
								<h3><span class="tsd-flag ts-flagStatic">Static</span> makeButton</h3>
								<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static">
									<li class="tsd-signature tsd-kind-icon">make<wbr>Button<span class="tsd-signature-symbol">(</span>options<span class="tsd-signature-symbol">?: </span><a href="../interfaces/wijmo_grid_cellmaker.ibuttonoptions.html" class="tsd-signature-type">IButtonOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules/wijmo_grid.html#icelltemplatefunction" class="tsd-signature-type">ICellTemplateFunction</a></li>
								</ul>
								<ul class="tsd-descriptions">
									<li class="tsd-description">
										<aside class="tsd-sources">
										</aside>
										<div class="tsd-comment">
											<div class="lead">
												<p>Creates a cell template with a button.</p>
											</div>
											<p>By default, the button displays the cell's bound text in it.
												If you want to show a fixed string, set the <b>options.text</b>
											property to the string you want to show.</p>
											<p>For example, the code below defines a column with button elements.
												All buttons show the same text ('Click Me') and show an alert when
											clicked:</p>
											<pre><code class="language-typescript"><span class="hljs-keyword">new</span> FlexGrid(<span class="hljs-string">'#theGrid'</span>, {
    autoGenerateColumns: <span class="hljs-literal">false</span>,
    columns: [
        { binding: <span class="hljs-string">'id'</span>, header: <span class="hljs-string">'ID'</span>, isReadOnly: <span class="hljs-literal">true</span> },
        {
            binding: <span class="hljs-string">'country'</span>,
            header: <span class="hljs-string">'My Buttons'</span>,
            cellTemplate: CellMaker.makeButton({
                text: <span class="hljs-string">'Click Me'</span>, <span class="hljs-comment">// override bound text</span>
                click: <span class="hljs-function">(<span class="hljs-params">e: MouseEvent, ctx: ICellTemplateContext</span>) =&gt;</span> {
                    alert(<span class="hljs-string">'Clicked Button ** '</span> + ctx.item.country + <span class="hljs-string">' **'</span>)
                }
            })
        }
    ]
});</code></pre>
											<p>To avoid disrupting the regular tab navigation, the button's
											<strong>tabindex</strong> attribute is set to -1 by default.</p>
											<p>If you want to include the buttons in the tab navigation,
												use the <strong>attributes</strong> option to set their <strong>tabindex</strong>
											attribute to zero. For example:</p>
											<pre><code class="language-typescript"><span class="hljs-keyword">new</span> FlexGrid(<span class="hljs-string">'#theGrid'</span>, {
    autoGenerateColumns: <span class="hljs-literal">false</span>,
    columns: [
        { binding: <span class="hljs-string">'id'</span>, header: <span class="hljs-string">'ID'</span>, isReadOnly: <span class="hljs-literal">true</span> },
        {
            binding: <span class="hljs-string">'country'</span>,
            header: <span class="hljs-string">'My Buttons'</span>,
            cellTemplate: CellMaker.makeButton({
                text: <span class="hljs-string">'Click Me'</span>, <span class="hljs-comment">// override bound text</span>
                click: <span class="hljs-function">(<span class="hljs-params">e: MouseEvent, ctx: ICellTemplateContext</span>) =&gt;</span> {
                    alert(<span class="hljs-string">'Clicked Button ** '</span> + ctx.item.country + <span class="hljs-string">' **'</span>)
                },
                attributes: {
                    tabindex: <span class="hljs-number">0</span> <span class="hljs-comment">// make button a tab stop</span>
                }
            })
        }
    ]
});</code></pre>
											<p>For details on links and button elements, please visit
											<a href="https://css-tricks.com/a-complete-guide-to-links-and-buttons/">https://css-tricks.com/a-complete-guide-to-links-and-buttons/</a>.</p>
										</div>
										<h4 class="tsd-parameters-title">Parameters</h4>
										<ul class="tsd-parameters">
											<li>
												<h5><span class="tsd-flag ts-flagOptional">Optional</span> options: <a href="../interfaces/wijmo_grid_cellmaker.ibuttonoptions.html" class="tsd-signature-type">IButtonOptions</a></h5>
												<div class="tsd-comment">
													<p><a href="../interfaces/wijmo_grid_cellmaker.ibuttonoptions.html">IButtonOptions</a> object containing parameters for the button.</p>
												</div>
											</li>
										</ul>
										<h4 class="tsd-returns-title">Returns <a href="../modules/wijmo_grid.html#icelltemplatefunction" class="tsd-signature-type">ICellTemplateFunction</a></h4>
										<p>An <a href="../modules/wijmo_grid.html#icelltemplatefunction">ICellTemplateFunction</a> to be assigned to a column's <a href="wijmo_grid.column.html#celltemplate">Column.cellTemplate</a> property.</p>
									</li>
								</ul>
							</section>
							<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static">
								<a name="makeimage" class="tsd-anchor"></a>
								<h3><span class="tsd-flag ts-flagStatic">Static</span> makeImage</h3>
								<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static">
									<li class="tsd-signature tsd-kind-icon">make<wbr>Image<span class="tsd-signature-symbol">(</span>options<span class="tsd-signature-symbol">?: </span><a href="../interfaces/wijmo_grid_cellmaker.icellmakeroptions.html" class="tsd-signature-type">ICellMakerOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules/wijmo_grid.html#icelltemplatefunction" class="tsd-signature-type">ICellTemplateFunction</a></li>
								</ul>
								<ul class="tsd-descriptions">
									<li class="tsd-description">
										<aside class="tsd-sources">
										</aside>
										<div class="tsd-comment">
											<div class="lead">
												<p>Creates a cell template with an image.</p>
											</div>
											<p>The cell should be bound to a string containing an image URL.</p>
											<p>For example, the code below defines a column with images located
											at urls specified by the 'img' member of the data items:</p>
											<pre><code class="language-typescript"><span class="hljs-keyword">new</span> FlexGrid(<span class="hljs-string">'#theGrid'</span>, {
    autoGenerateColumns: <span class="hljs-literal">false</span>,
    columns: [
        { binding: <span class="hljs-string">'id'</span>, header: <span class="hljs-string">'ID'</span>, isReadOnly: <span class="hljs-literal">true</span> },
        {
            binding: <span class="hljs-string">'img'</span>,
            header: <span class="hljs-string">'Images'</span>,
            cssClass: <span class="hljs-string">'cell-img'</span>,
            cellTemplate: CellMaker.makeImage({
                label: <span class="hljs-string">'image for ${item.country}'</span>, <span class="hljs-comment">// accessibility</span>
                click: <span class="hljs-function">(<span class="hljs-params">e, ctx</span>) =&gt;</span> alert(<span class="hljs-string">'Clicked image for '</span> + ctx.item.country)
            })
        }
    ]
});</code></pre>
										</div>
										<h4 class="tsd-parameters-title">Parameters</h4>
										<ul class="tsd-parameters">
											<li>
												<h5><span class="tsd-flag ts-flagOptional">Optional</span> options: <a href="../interfaces/wijmo_grid_cellmaker.icellmakeroptions.html" class="tsd-signature-type">ICellMakerOptions</a></h5>
												<div class="tsd-comment">
													<p><a href="../interfaces/wijmo_grid_cellmaker.icellmakeroptions.html">ICellMakerOptions</a> object containing parameters for the image.
													It should include the <b>label</b> property for accessibility.</p>
												</div>
											</li>
										</ul>
										<h4 class="tsd-returns-title">Returns <a href="../modules/wijmo_grid.html#icelltemplatefunction" class="tsd-signature-type">ICellTemplateFunction</a></h4>
										<p>An <a href="../modules/wijmo_grid.html#icelltemplatefunction">ICellTemplateFunction</a> to be assigned to a column's <a href="wijmo_grid.column.html#celltemplate">Column.cellTemplate</a> property.</p>
									</li>
								</ul>
							</section>
							<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static">
								<a name="makelink" class="tsd-anchor"></a>
								<h3><span class="tsd-flag ts-flagStatic">Static</span> makeLink</h3>
								<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static">
									<li class="tsd-signature tsd-kind-icon">make<wbr>Link<span class="tsd-signature-symbol">(</span>options<span class="tsd-signature-symbol">?: </span><a href="../interfaces/wijmo_grid_cellmaker.ilinkoptions.html" class="tsd-signature-type">ILinkOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules/wijmo_grid.html#icelltemplatefunction" class="tsd-signature-type">ICellTemplateFunction</a></li>
								</ul>
								<ul class="tsd-descriptions">
									<li class="tsd-description">
										<aside class="tsd-sources">
										</aside>
										<div class="tsd-comment">
											<div class="lead">
												<p>Creates a cell template with a hyperlink.</p>
											</div>
											<p>By default, the link displays the cell's bound text in it.
												If you want to show a fixed string, set the <b>options.text</b>
											property to the string you want to show.</p>
											<p>For example, the code below defines a column with hyperlink elements.
												The links show some custom text and link to a url from the cell's
											data item:</p>
											<pre><code class="language-typescript"><span class="hljs-keyword">new</span> FlexGrid(<span class="hljs-string">'#theGrid'</span>, {
    autoGenerateColumns: <span class="hljs-literal">false</span>,
    columns: [
        { binding: <span class="hljs-string">'id'</span>, header: <span class="hljs-string">'ID'</span>, isReadOnly: <span class="hljs-literal">true</span> },
        {
            binding: <span class="hljs-string">'country'</span>,
            header: <span class="hljs-string">'My Links'</span>,
            cellTemplate: CellMaker.makeLink({
                text: <span class="hljs-string">'Visit ${item.country}'</span>, <span class="hljs-comment">// override bound text</span>
                href: <span class="hljs-string">'${item.url}'</span>, <span class="hljs-comment">// bound link destination</span>
                attributes: {
                    tabindex: <span class="hljs-number">0</span> <span class="hljs-comment">// make hyperlink a tab stop</span>
                }
            })
        }
    ]
});</code></pre>
											<p>To avoid disrupting the regular tab navigation, the hyperlink's
											<strong>tabindex</strong> attribute is set to -1 by default.</p>
											<p>If you want to include the hyperlinks in the tab navigation,
												use the <strong>attributes</strong> option to set their <strong>tabindex</strong>
											attribute to zero. For example:</p>
											<pre><code class="language-typescript"><span class="hljs-keyword">new</span> FlexGrid(<span class="hljs-string">'#theGrid'</span>, {
    autoGenerateColumns: <span class="hljs-literal">false</span>,
    columns: [
        { binding: <span class="hljs-string">'id'</span>, header: <span class="hljs-string">'ID'</span>, isReadOnly: <span class="hljs-literal">true</span> },
        {
            binding: <span class="hljs-string">'country'</span>,
            header: <span class="hljs-string">'My Links'</span>,
            cellTemplate: CellMaker.makeLink({
                text: <span class="hljs-string">'Visit ${item.country}'</span>, <span class="hljs-comment">// override bound text</span>
                href: <span class="hljs-string">'${item.url}'</span>, <span class="hljs-comment">// bound link destination</span>
                <span class="hljs-comment">// no need for click handler, the link navigates automatically</span>
            })
        }
    ]
});</code></pre>
											<p>For details on links and button elements, please visit
											<a href="https://css-tricks.com/a-complete-guide-to-links-and-buttons/">https://css-tricks.com/a-complete-guide-to-links-and-buttons/</a>.</p>
										</div>
										<h4 class="tsd-parameters-title">Parameters</h4>
										<ul class="tsd-parameters">
											<li>
												<h5><span class="tsd-flag ts-flagOptional">Optional</span> options: <a href="../interfaces/wijmo_grid_cellmaker.ilinkoptions.html" class="tsd-signature-type">ILinkOptions</a></h5>
												<div class="tsd-comment">
													<p><a href="../interfaces/wijmo_grid_cellmaker.ilinkoptions.html">ILinkOptions</a> object containing parameters for the hyperlink.</p>
												</div>
											</li>
										</ul>
										<h4 class="tsd-returns-title">Returns <a href="../modules/wijmo_grid.html#icelltemplatefunction" class="tsd-signature-type">ICellTemplateFunction</a></h4>
										<p>An <a href="../modules/wijmo_grid.html#icelltemplatefunction">ICellTemplateFunction</a> to be assigned to a column's <a href="wijmo_grid.column.html#celltemplate">Column.cellTemplate</a> property.</p>
									</li>
								</ul>
							</section>
							<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static">
								<a name="makerating" class="tsd-anchor"></a>
								<h3><span class="tsd-flag ts-flagStatic">Static</span> makeRating</h3>
								<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static">
									<li class="tsd-signature tsd-kind-icon">make<wbr>Rating<span class="tsd-signature-symbol">(</span>options<span class="tsd-signature-symbol">?: </span><a href="../interfaces/wijmo_grid_cellmaker.iratingoptions.html" class="tsd-signature-type">IRatingOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules/wijmo_grid.html#icelltemplatefunction" class="tsd-signature-type">ICellTemplateFunction</a></li>
								</ul>
								<ul class="tsd-descriptions">
									<li class="tsd-description">
										<aside class="tsd-sources">
										</aside>
										<div class="tsd-comment">
											<div class="lead">
												<p>Creates a cell template to show and edit a rating value.</p>
											</div>
											<p>The cell should be bound to a string containing a number that
											represents a rating.</p>
											<p>By default, cells show ratings as stars. You may customize
											the appearance of rating cells using CSS.</p>
											<p>For example, the code below defines a column with stars that
												show the 'rating' member of the data items.
												Since the column is not read-only, users may edit the ratings
											using the keyboard or the mouse:</p>
											<pre><code class="language-typescript"><span class="hljs-keyword">new</span> FlexGrid(<span class="hljs-string">'#theGrid'</span>, {
    autoGenerateColumns: <span class="hljs-literal">false</span>,
    columns: [
        { binding: <span class="hljs-string">'id'</span>, header: <span class="hljs-string">'ID'</span>, isReadOnly: <span class="hljs-literal">true</span> },
        {
            binding: <span class="hljs-string">'rating'</span>,
            header: <span class="hljs-string">'Rating (editable)'</span>,
            width: <span class="hljs-number">220</span>,
            align: <span class="hljs-string">'center'</span>,
            cellTemplate: CellMaker.makeRating({
                range: [<span class="hljs-number">0</span>, <span class="hljs-number">5</span>], <span class="hljs-comment">// rating values between 0 and 5</span>
                label: <span class="hljs-string">'Edit Product Rating'</span>
            })
       }
    ]
});</code></pre>
										</div>
										<h4 class="tsd-parameters-title">Parameters</h4>
										<ul class="tsd-parameters">
											<li>
												<h5><span class="tsd-flag ts-flagOptional">Optional</span> options: <a href="../interfaces/wijmo_grid_cellmaker.iratingoptions.html" class="tsd-signature-type">IRatingOptions</a></h5>
												<div class="tsd-comment">
													<p><a href="../interfaces/wijmo_grid_cellmaker.iratingoptions.html">IRatingOptions</a> object containing parameters for the rating cell.</p>
												</div>
											</li>
										</ul>
										<h4 class="tsd-returns-title">Returns <a href="../modules/wijmo_grid.html#icelltemplatefunction" class="tsd-signature-type">ICellTemplateFunction</a></h4>
										<p>An <a href="../modules/wijmo_grid.html#icelltemplatefunction">ICellTemplateFunction</a> to be assigned to a column's <a href="wijmo_grid.column.html#celltemplate">Column.cellTemplate</a> property.</p>
									</li>
								</ul>
							</section>
							<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static">
								<a name="makesparkline" class="tsd-anchor"></a>
								<h3><span class="tsd-flag ts-flagStatic">Static</span> makeSparkline</h3>
								<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static">
									<li class="tsd-signature tsd-kind-icon">make<wbr>Sparkline<span class="tsd-signature-symbol">(</span>options<span class="tsd-signature-symbol">?: </span><a href="../interfaces/wijmo_grid_cellmaker.isparklineoptions.html" class="tsd-signature-type">ISparkLineOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules/wijmo_grid.html#icelltemplatefunction" class="tsd-signature-type">ICellTemplateFunction</a></li>
								</ul>
								<ul class="tsd-descriptions">
									<li class="tsd-description">
										<aside class="tsd-sources">
										</aside>
										<div class="tsd-comment">
											<div class="lead">
												<p>Creates a cell template with a sparkline.</p>
											</div>
											<p>The cell should be bound to an array of numbers to be shown as a
											mini line chart.</p>
											<p>For example, the code below defines a column with sparklines
												showing the content of the 'history' array in the cell's data item.
											You may customize the appearance of the sparklines using CSS:</p>
											<pre><code class="language-typescript"><span class="hljs-keyword">new</span> FlexGrid(<span class="hljs-string">'#theGrid'</span>, {
    autoGenerateColumns: <span class="hljs-literal">false</span>,
    columns: [
        { binding: <span class="hljs-string">'id'</span>, header: <span class="hljs-string">'ID'</span>, isReadOnly: <span class="hljs-literal">true</span> },
        {
            binding: <span class="hljs-string">'history'</span>,
            header: <span class="hljs-string">'History Sparklines'</span>,
            width: <span class="hljs-number">175</span>,
            cellTemplate: CellMaker.makeSparkline({
                markers: SparklineMarkers.High | SparklineMarkers.Low, <span class="hljs-comment">// add markers</span>
                maxPoints: <span class="hljs-number">25</span>, <span class="hljs-comment">// limit number of points</span>
                label: <span class="hljs-string">'${item.country} sales history line chart'</span>, <span class="hljs-comment">// accessibility</span>
            })
        }
    ]
});</code></pre>
										</div>
										<h4 class="tsd-parameters-title">Parameters</h4>
										<ul class="tsd-parameters">
											<li>
												<h5><span class="tsd-flag ts-flagOptional">Optional</span> options: <a href="../interfaces/wijmo_grid_cellmaker.isparklineoptions.html" class="tsd-signature-type">ISparkLineOptions</a></h5>
												<div class="tsd-comment">
													<p><a href="../interfaces/wijmo_grid_cellmaker.isparklineoptions.html">ISparkLineOptions</a> object containing parameters for the Sparkline.
													It should include the <b>label</b> property for accessibility.</p>
												</div>
											</li>
										</ul>
										<h4 class="tsd-returns-title">Returns <a href="../modules/wijmo_grid.html#icelltemplatefunction" class="tsd-signature-type">ICellTemplateFunction</a></h4>
										<p>An <a href="../modules/wijmo_grid.html#icelltemplatefunction">ICellTemplateFunction</a> to be assigned to a column's <a href="wijmo_grid.column.html#celltemplate">Column.cellTemplate</a> property.</p>
									</li>
								</ul>
							</section>
						</section>
					</div>