<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Grid &#8211; Sibeesh Passion</title>
	<atom:link href="https://mail.sibeeshpassion.com/tag/grid/feed/" rel="self" type="application/rss+xml" />
	<link>https://mail.sibeeshpassion.com</link>
	<description>My passion towards life</description>
	<lastBuildDate>Wed, 02 Jun 2021 15:23:17 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>/wp-content/uploads/2017/04/Sibeesh_Passion_Logo_Small.png</url>
	<title>Grid &#8211; Sibeesh Passion</title>
	<link>https://mail.sibeeshpassion.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Custom Deferred Grid Using MVC Web API And Angular JS</title>
		<link>https://mail.sibeeshpassion.com/custom-deferred-grid-using-mvc-web-api-and-angular-js/</link>
					<comments>https://mail.sibeeshpassion.com/custom-deferred-grid-using-mvc-web-api-and-angular-js/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Mon, 29 Feb 2016 00:00:41 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Angular]]></category>
		<category><![CDATA[Web API]]></category>
		<category><![CDATA[Angular JS]]></category>
		<category><![CDATA[Deffered Grid]]></category>
		<category><![CDATA[Grid]]></category>
		<category><![CDATA[Load data while scrolling in Angular JS]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[SqlDataAdapter And Web API]]></category>
		<category><![CDATA[virtualRepeat]]></category>
		<category><![CDATA[Web API With Stored Procedure]]></category>
		<category><![CDATA[Web API Without Entity Data Model]]></category>
		<category><![CDATA[Web API Without Entity Framework]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=11296</guid>

					<description><![CDATA[[toc] Introduction In this article we are going to see how to create a custom deferred grid in MVC using Web API and Angular JS. We will be creating a custom UI for the grid and using web API and angular JS $http services we will fetch the data from the database. Normally we uses ADO.Net Entity data model as the model class when we work with a Web API right? Instead of using an Entity data model, here we are going to use our normal SqlDataAdapter and SqlConnection and stored procedure to get the data from our database. We [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>[toc]</p>
<h2>Introduction</h2>
<p>In this article we are going to see how to create a custom deferred grid in <a href="http://sibeeshpassion.com/category/mvc/" target="_blank" rel="noopener">MVC </a>using <a href="http://sibeeshpassion.com/category/web-api" target="_blank" rel="noopener">Web API</a> and <a href="http://sibeeshpassion.com/category/angularjs" target="_blank" rel="noopener">Angular JS</a>. We will be creating a custom UI for the grid and using web API and angular JS $http services we will fetch the data from the database. Normally we uses ADO.Net Entity data model as the model class when we work with a Web API right? Instead of using an Entity data model, here we are going to use our normal SqlDataAdapter and SqlConnection and stored procedure to get the data from our database. We uses Virtual Repeat in Angular JS for loading the data in UI, so that the data will be loaded when ever there is a user action that is scrolling (Virtual Scrolling). So that in the view port we will load only few items first. Now shall we go and see this in detail? I hope you will like this.</p>
<h2><strong>Download the source code</strong></h2>
<p>You can always download the source code here:</p>
<ul>
<li><a href="https://code.msdn.microsoft.com/Custom-Deferred-Grid-Using-de1d1c6e" target="_blank" rel="noopener">Custom Deferred Grid Using MVC Web API And Angular JS</a></li>
<li><a href="http://sibeeshpassion.com/Download/jQuery_Datatable_With_Server_Side_Data_Script.zip" target="_blank" rel="noopener">Trials Database SQL Script</a></li>
</ul>
<h2><strong>Background</strong></h2>
<p>We have so many plugins available to show the data in a grid format. Isn&#8217;t it? if you want to know a few of them, you can find it <a href="http://sibeeshpassion.com/tag/grid/" target="_blank" rel="noopener">here</a>. Now, what if you need to show the data in a grid format without using any additional plugins? What if you need to load the data to that grid dynamically that is whenever the user scrolls the grid? If you could not find the answer to these questions, here in this post I am going to share an option. I hope you will enjoy reading.</p>
<h2><strong>Create an MVC application</strong></h2>
<p>Click File-&gt; New-&gt; Project then select MVC application. Before going to start the coding part, make sure that Angular JS is installed. You can all the items mentioned above from NuGet. Right click on your project name and select Manage NuGet packages.</p>
<div id="attachment_11297" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/02/Angular-JS-NuGet-Package-Visual-Studio.png"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-11297" class="size-large wp-image-11297" src="http://sibeeshpassion.com/wp-content/uploads/2016/02/Angular-JS-NuGet-Package-Visual-Studio-1024x502.png" alt="Angular JS NuGet Package Visual Studio" width="634" height="311" srcset="/wp-content/uploads/2016/02/Angular-JS-NuGet-Package-Visual-Studio-1024x502.png 1024w, /wp-content/uploads/2016/02/Angular-JS-NuGet-Package-Visual-Studio-300x147.png 300w, /wp-content/uploads/2016/02/Angular-JS-NuGet-Package-Visual-Studio-768x376.png 768w, /wp-content/uploads/2016/02/Angular-JS-NuGet-Package-Visual-Studio-400x196.png 400w, /wp-content/uploads/2016/02/Angular-JS-NuGet-Package-Visual-Studio-1224x600.png 1224w, /wp-content/uploads/2016/02/Angular-JS-NuGet-Package-Visual-Studio.png 1461w" sizes="(max-width: 634px) 100vw, 634px" /></a><p id="caption-attachment-11297" class="wp-caption-text">Angular JS NuGet Package Visual Studio</p></div>
<p>Once you have installed, please make sure that all the items are loaded in your scripts folder.</p>
<h2><strong>Using the code</strong></h2>
<p>I hope everything is set now, then it is time to start our coding. First we will create a controller action and a view. Below is the code snippet of our controller.</p>
<p>[csharp]<br />
using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Web;<br />
using System.Web.Mvc;<br />
namespace Custom_Deffered_Grid_Using_MVC_Web_API_And_Angular_JS.Controllers<br />
{<br />
public class DefaultController : Controller<br />
{<br />
// GET: Default<br />
public ActionResult Index()<br />
{<br />
return View();<br />
}<br />
}<br />
}<br />
[/csharp]</p>
<p>Here <em>Default/em&gt; is my controller name. Now create a view for this action, and load the needed references.</em></p>
<p>[html]</p>
<p>@{<br />
ViewBag.Title = &#8220;Index&#8221;;<br />
}</p>
<p>&lt;h2&gt;Index&lt;/h2&gt;<br />
&lt;link href=&#8221;~/Content/angular-material.css&#8221; rel=&#8221;stylesheet&#8221; /&gt;<br />
&lt;script src=&#8221;~/scripts/angular.min.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script src=&#8221;~/scripts/angular-route.min.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script src=&#8221;~/scripts/angular-aria.min.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script src=&#8221;~/scripts/angular-animate.min.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script src=&#8221;~/scripts/angular-messages.min.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script src=&#8221;~/scripts/angular-material.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script src=&#8221;~/scripts/svg-assets-cache.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script src=&#8221;~/scripts/Default/Default.js&#8221;&gt;&lt;/script&gt;<br />
[/html]</p>
<p>You can get this files from the source code attached with this article. And the file <em>Default.js</em> is the additional file where we are requested to do our additional scripts. So far the basic implementation of our view is done. Now we will create a Web API and additional model class to fetch the data from the database. Are you ready?</p>
<p>Below is my Web API controller.</p>
<p>[csharp]<br />
using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Net;<br />
using System.Net.Http;<br />
using System.Web.Http;<br />
using Custom_Deffered_Grid_Using_MVC_Web_API_And_Angular_JS.Models;<br />
namespace Custom_Deffered_Grid_Using_MVC_Web_API_And_Angular_JS.Controllers<br />
{<br />
public class DataAPIController : ApiController<br />
{<br />
DataModel dm = new DataModel();<br />
public string getData(int id)<br />
{<br />
var d = dm.fetchData(id);<br />
return d;<br />
}<br />
}</p>
<p>}<br />
[/csharp]</p>
<p>Have you noticed that I have included <em>using Custom_Deffered_Grid_Using_MVC_Web_API_And_Angular_JS.Models;</em> in the section? This is to ensure that we can use the model classes whatever we have creates so far. In this case <em>DataModel </em>is our model class and we are creating an instance for the same.</p>
<p>[csharp]<br />
DataModel dm = new DataModel();<br />
[/csharp]</p>
<p>The controller action <em>getData</em> accepting the parameter id right? This is actually the page offset value which we are passing from the client side. Now we will create our model class, you can find the code snippets below for that.</p>
<p>[csharp]<br />
using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Web;<br />
using System.Data;<br />
using System.Data.Sql;<br />
using System.Data.SqlClient;<br />
using System.Configuration;<br />
namespace Custom_Deffered_Grid_Using_MVC_Web_API_And_Angular_JS.Models<br />
{<br />
public class DataModel<br />
{<br />
public string fetchData(int pageOffset)<br />
{<br />
string connection = ConfigurationManager.ConnectionStrings[&#8220;TrialsDBEntities&#8221;].ConnectionString;<br />
using (SqlConnection cn = new SqlConnection(connection))<br />
{<br />
SqlCommand cmd = new SqlCommand(&#8220;usp_Get_SalesOrderDetailPage&#8221;, cn);<br />
cmd.Parameters.Add(&#8220;@pageoffset&#8221;, SqlDbType.Int).Value = pageOffset;<br />
cmd.CommandType = CommandType.StoredProcedure;<br />
try<br />
{<br />
DataTable dt = new DataTable();<br />
SqlDataAdapter da = new SqlDataAdapter(cmd);<br />
cn.Open();<br />
da.Fill(dt);<br />
return GetJson(dt);<br />
}<br />
catch (Exception)<br />
{<br />
throw;<br />
}</p>
<p>}<br />
}<br />
}<br />
}<br />
[/csharp]</p>
<p>As I said before, instead of using an entity model we uses our normal sql connections and sql data adapter to load the data. Before going to use this function, please make sure that you have added the below references.</p>
<p>[csharp]<br />
using System.Data;<br />
using System.Data.Sql;<br />
using System.Data.SqlClient;<br />
using System.Configuration;<br />
[/csharp]</p>
<p>Now coming back to the <em>fetchData </em>function , We uses the connection string <em>TrialsDBEntities</em> from the web config file. So it is mandatory that you must have a connection string with that name in your web config file. Once that is done, we calls the stored procedure <em>usp_Get_SalesOrderDetailPage</em> and fill the data using <em>SqlDataAdapter</em>.</p>
<p>Another thing to be notified here is we are passing that <em>DataTable</em> to a function called <em>GetJson</em>. So you must have the definition for that too.</p>
<p>[csharp]<br />
public string GetJson(DataTable dt)<br />
{<br />
try<br />
{<br />
if (dt == null)<br />
{<br />
throw new ArgumentNullException(&#8220;dt&#8221;);<br />
}<br />
System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();<br />
List&lt;Dictionary&lt;string, object&gt;&gt; rows =<br />
new List&lt;Dictionary&lt;string, object&gt;&gt;();<br />
Dictionary&lt;string, object&gt; row = null;<br />
foreach (DataRow dr in dt.Rows)<br />
{<br />
row = new Dictionary&lt;string, object&gt;();<br />
foreach (DataColumn col in dt.Columns)<br />
{<br />
row.Add(col.ColumnName.Trim(), dr[col]);<br />
}<br />
rows.Add(row);<br />
}<br />
return serializer.Serialize(rows);<br />
}<br />
catch (Exception)<br />
{<br />
throw;<br />
}<br />
}<br />
[/csharp]</p>
<p>What this function does it, converting the data table to a <a href="http://sibeeshpassion.com/tag/JSON/" target="_blank" rel="noopener">JSON </a>format. So far, the coding related to Web API is done, now it is time to create a database, table, a stored procedure.</p>
<h3><strong>Create a database</strong></h3>
<p>The following query can be used to create a database in your SQL Server.</p>
<p>[sql]<br />
USE [master]<br />
GO</p>
<p>/****** Object: Database [TrialsDB] Script Date: 25-Feb-16 12:34:32 PM ******/<br />
CREATE DATABASE [TrialsDB]<br />
CONTAINMENT = NONE<br />
ON PRIMARY<br />
( NAME = N&#8217;TrialsDB&#8217;, FILENAME = N&#8217;C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\TrialsDB.mdf&#8217; , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )<br />
LOG ON<br />
( NAME = N&#8217;TrialsDB_log&#8217;, FILENAME = N&#8217;C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\TrialsDB_log.ldf&#8217; , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET COMPATIBILITY_LEVEL = 110<br />
GO</p>
<p>IF (1 = FULLTEXTSERVICEPROPERTY(&#8216;IsFullTextInstalled&#8217;))<br />
begin<br />
EXEC [TrialsDB].[dbo].[sp_fulltext_database] @action = &#8216;enable&#8217;<br />
end<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET ANSI_NULL_DEFAULT OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET ANSI_NULLS OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET ANSI_PADDING OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET ANSI_WARNINGS OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET ARITHABORT OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET AUTO_CLOSE OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET AUTO_CREATE_STATISTICS ON<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET AUTO_SHRINK OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET AUTO_UPDATE_STATISTICS ON<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET CURSOR_CLOSE_ON_COMMIT OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET CURSOR_DEFAULT GLOBAL<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET CONCAT_NULL_YIELDS_NULL OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET NUMERIC_ROUNDABORT OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET QUOTED_IDENTIFIER OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET RECURSIVE_TRIGGERS OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET DISABLE_BROKER<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET AUTO_UPDATE_STATISTICS_ASYNC OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET DATE_CORRELATION_OPTIMIZATION OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET TRUSTWORTHY OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET ALLOW_SNAPSHOT_ISOLATION OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET PARAMETERIZATION SIMPLE<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET READ_COMMITTED_SNAPSHOT OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET HONOR_BROKER_PRIORITY OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET RECOVERY FULL<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET MULTI_USER<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET PAGE_VERIFY CHECKSUM<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET DB_CHAINING OFF<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF )<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET TARGET_RECOVERY_TIME = 0 SECONDS<br />
GO</p>
<p>ALTER DATABASE [TrialsDB] SET READ_WRITE<br />
GO<br />
[/sql]</p>
<p>Now we will create a table 🙂</p>
<h3><strong>Create table in database</strong></h3>
<p>Below is the query to create table in database.</p>
<p>[sql]<br />
USE [TrialsDB]<br />
GO</p>
<p>/****** Object: Table [dbo].[SalesOrderDetail] Script Date: 25-Feb-16 12:35:45 PM ******/<br />
SET ANSI_NULLS ON<br />
GO</p>
<p>SET QUOTED_IDENTIFIER ON<br />
GO</p>
<p>CREATE TABLE [dbo].[SalesOrderDetail](<br />
[SalesOrderID] [int] NOT NULL,<br />
[SalesOrderDetailID] [int] IDENTITY(1,1) NOT NULL,<br />
[CarrierTrackingNumber] [nvarchar](25) NULL,<br />
[OrderQty] [smallint] NOT NULL,<br />
[ProductID] [int] NOT NULL,<br />
[SpecialOfferID] [int] NOT NULL,<br />
[UnitPrice] [money] NOT NULL,<br />
[UnitPriceDiscount] [money] NOT NULL,<br />
[LineTotal] AS (isnull(([UnitPrice]*((1.0)-[UnitPriceDiscount]))*[OrderQty],(0.0))),<br />
[rowguid] [uniqueidentifier] ROWGUIDCOL NOT NULL,<br />
[ModifiedDate] [datetime] NOT NULL,<br />
CONSTRAINT [PK_SalesOrderDetail_SalesOrderID_SalesOrderDetailID] PRIMARY KEY CLUSTERED<br />
(<br />
[SalesOrderID] ASC,<br />
[SalesOrderDetailID] ASC<br />
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]<br />
) ON [PRIMARY]</p>
<p>GO<br />
[/sql]</p>
<p>Can we insert some data to the table now?</p>
<h3><strong>Insert data to table</strong></h3>
<p>To insert the data, I will attach a database script file along with the download file, you can either run that or insert some data by using the below query. By the way if you would like to know how to generate scripts with data in SQL Server, you can check <a href="http://sibeeshpassion.com/generate-database-scripts-with-data-in-sql-server/" target="_blank" rel="noopener">here</a>.</p>
<p>[sql]<br />
USE [TrialsDB]<br />
GO</p>
<p>INSERT INTO [dbo].[SalesOrderDetail]<br />
([SalesOrderID]<br />
,[CarrierTrackingNumber]<br />
,[OrderQty]<br />
,[ProductID]<br />
,[SpecialOfferID]<br />
,[UnitPrice]<br />
,[UnitPriceDiscount]<br />
,[rowguid]<br />
,[ModifiedDate])<br />
VALUES<br />
(&lt;SalesOrderID, int,&gt;<br />
,&lt;CarrierTrackingNumber, nvarchar(25),&gt;<br />
,&lt;OrderQty, smallint,&gt;<br />
,&lt;ProductID, int,&gt;<br />
,&lt;SpecialOfferID, int,&gt;<br />
,&lt;UnitPrice, money,&gt;<br />
,&lt;UnitPriceDiscount, money,&gt;<br />
,&lt;rowguid, uniqueidentifier,&gt;<br />
,&lt;ModifiedDate, datetime,&gt;)<br />
GO<br />
[/sql]</p>
<p>Along with this, we can create a new stored procedure which will fetch the data. Following is the query to create the stored procedure.</p>
<p>[sql]<br />
USE [TrialsDB]<br />
GO<br />
/****** Object: StoredProcedure [dbo].[usp_Get_SalesOrderDetailPage] Script Date: 25-Feb-16 12:53:07 PM ******/<br />
SET ANSI_NULLS ON<br />
GO<br />
SET QUOTED_IDENTIFIER ON<br />
GO<br />
&#8212; =============================================<br />
&#8212; Author: &lt;Author,Sibeesh Venu&gt;<br />
&#8212; Create date: &lt;Create Date, 18-Feb-2016&gt;<br />
&#8212; Description: &lt;Description,To fetch SalesOrderDetail Page Wise&gt;<br />
&#8212; =============================================<br />
ALTER PROCEDURE [dbo].[usp_Get_SalesOrderDetailPage] @pageOffset int=0 AS BEGIN &#8212; SET NOCOUNT ON added to prevent extra result sets from<br />
&#8212; interfering with SELECT statements.</p>
<p>SET NOCOUNT ON;</p>
<p>WITH CTE_Sales(SlNo, SalesOrderID,SalesOrderDetailID,CarrierTrackingNumber,OrderQty,ProductID,UnitPrice,ModifiedDate) AS<br />
( SELECT ROW_NUMBER() over (<br />
ORDER BY ModifiedDate DESC) AS SlNo,<br />
SalesOrderID,<br />
SalesOrderDetailID,<br />
CarrierTrackingNumber,<br />
OrderQty,<br />
ProductID,<br />
UnitPrice,<br />
ModifiedDate<br />
FROM dbo.SalesOrderDetail)<br />
SELECT *<br />
FROM CTE_Sales<br />
WHERE SlNo&gt;=@pageOffset<br />
AND SlNo&lt;@pageOffset+10 END</p>
<p>&#8211;[usp_Get_SalesOrderDetailPage] 4<br />
[/sql]</p>
<p>Here we are using Common Table Expressions in SQL Server. If you are new to CTE, you can always see here <a href="http://sibeeshpassion.com/stored-procedure-with-common-table-expression-or-cte/" target="_blank" rel="noopener">Common Table Expression Example</a> for some more informations regarding that. It seems the database is ready with the data now. Then we can go back to our view. We will change our view as follows with the custom styles.</p>
<p>[html]</p>
<p>@{<br />
ViewBag.Title = &#8220;Index&#8221;;<br />
}</p>
<p>&lt;h2&gt;Index&lt;/h2&gt;<br />
&lt;link href=&#8221;~/Content/angular-material.css&#8221; rel=&#8221;stylesheet&#8221; /&gt;<br />
&lt;style&gt;<br />
.virtualRepeatdemoDeferredLoading #vertical-container {<br />
padding: 10px;<br />
border: 1px solid #ccc;<br />
border-radius: 5px;<br />
box-shadow: 1px 10px 10px 1px #ccc;<br />
background-color: #fff;<br />
width: 40%;<br />
height: 390px;<br />
margin: 20px;<br />
}</p>
<p>.virtualRepeatdemoDeferredLoading .repeated-item {<br />
border-bottom: 1px solid #ddd;<br />
box-sizing: border-box;<br />
height: 40px;<br />
padding: 10px;<br />
border: 1px solid #ccc;<br />
border-radius: 5px;<br />
box-shadow: 1px 10px 10px 1px #ccc;<br />
background-color: #fff;<br />
width: 90%;<br />
height: 120px;<br />
margin: 20px;<br />
color: #aaa;<br />
font-size: 12px;<br />
line-height: 20px;<br />
}</p>
<p>.virtualRepeatdemoDeferredLoading md-content {<br />
margin: 16px;<br />
}</p>
<p>.virtualRepeatdemoDeferredLoading md-virtual-repeat-container {<br />
border: solid 1px grey;<br />
}</p>
<p>.virtualRepeatdemoDeferredLoading .md-virtual-repeat-container .md-virtual-repeat-offsetter div {<br />
padding-left: 16px;<br />
}</p>
<p>#introduction {<br />
border-bottom: 1px solid #ddd;<br />
box-sizing: border-box;<br />
height: 40px;<br />
padding: 10px;<br />
border: 1px solid #ccc;<br />
border-radius: 5px;<br />
box-shadow: 1px 10px 10px 1px #ccc;<br />
background-color: #fff;<br />
width: 98%;<br />
height: 70px;<br />
color: #aaa;<br />
font-size: 12px;<br />
line-height: 25px;<br />
}<br />
&lt;/style&gt;<br />
&lt;div ng-controller=&#8221;AppCtrl as ctrl&#8221; ng-cloak=&#8221;&#8221; class=&#8221;virtualRepeatdemoDeferredLoading&#8221; ng-app=&#8221;MyApp&#8221;&gt;<br />
&lt;md-content layout=&#8221;column&#8221;&gt;<br />
&lt;div id=&#8221;introduction&#8221;&gt;<br />
&lt;p&gt;<br />
Please scroll the Grid to load the data from database. This is a simple demo of deffered or virtual data loading in Angular JS.<br />
We created this application MVC with Web API to fetch the data. I hope you enjoyed the demo. Please visit again 🙂<br />
&lt;/p&gt;<br />
&lt;/div&gt;<br />
&lt;md-virtual-repeat-container id=&#8221;vertical-container&#8221;&gt;<br />
&lt;div md-virtual-repeat=&#8221;item in ctrl.dynamicItems&#8221; md-on-demand=&#8221;&#8221; class=&#8221;repeated-item&#8221; flex=&#8221;&#8221;&gt;<br />
&lt;div&gt; &lt;b&gt;SlNo:&lt;/b&gt; {{item.SlNo}}, &lt;b&gt;SalesOrderID:&lt;/b&gt; {{item.SalesOrderID}}&lt;/div&gt;<br />
&lt;div&gt; &lt;b&gt;SalesOrderDetailID:&lt;/b&gt; {{item.SalesOrderDetailID}}, &lt;b&gt;CarrierTrackingNumber:&lt;/b&gt; {{item.CarrierTrackingNumber}}&lt;/div&gt;<br />
&lt;div&gt; &lt;b&gt;OrderQty:&lt;/b&gt; {{item.OrderQty}}, &lt;b&gt;ProductID:&lt;/b&gt; {{item.ProductID}}&lt;/div&gt;<br />
&lt;div&gt; &lt;b&gt;UnitPrice:&lt;/b&gt; {{item.UnitPrice}}&lt;/div&gt;<br />
&lt;/div&gt;<br />
&lt;/md-virtual-repeat-container&gt;</p>
<p>&lt;/md-content&gt;</p>
<p>&lt;/div&gt;<br />
&lt;script src=&#8221;~/scripts/angular.min.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script src=&#8221;~/scripts/angular-route.min.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script src=&#8221;~/scripts/angular-aria.min.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script src=&#8221;~/scripts/angular-animate.min.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script src=&#8221;~/scripts/angular-messages.min.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script src=&#8221;~/scripts/angular-material.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script src=&#8221;~/scripts/svg-assets-cache.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script src=&#8221;~/scripts/Default/Default.js&#8221;&gt;&lt;/script&gt;<br />
[/html]</p>
<p>As you can see form the above code, our Angular JS controller is <em>ng-controller=&#8221;AppCtrl as ctrl&#8221;</em> and the Angular JS app is <em>ng-app=&#8221;MyApp&#8221;</em>. We uses <em>md-virtual-repeat</em> as a repeater control, so that it can be used to loop through the object <em>item in ctrl.dynamicItems</em>. Now it is time to create our Angular JS scripts. Shall we?</p>
<p>We can create our Angular App and Controller as follows.</p>
<p>[js]<br />
(function () {<br />
&#8216;use strict&#8217;;<br />
angular<br />
.module(&#8216;MyApp&#8217;, [&#8216;ngMaterial&#8217;, &#8216;ngMessages&#8217;, &#8216;material.svgAssetsCache&#8217;])<br />
.controller(&#8216;AppCtrl&#8217;, function ($http, $timeout) {<br />
});<br />
})();<br />
[/js]</p>
<p>Now in the controller we will add a function with some predefined items as follows.</p>
<p>[js]<br />
var DynamicItems = function () {<br />
this.loadedPages = {};<br />
this.numItems = 0;<br />
this.PAGE_SIZE = 10;<br />
this.fetchNumItems_();<br />
};<br />
[/js]</p>
<p>Here <em>loadedPages</em> is the data collection which is keyed by the page number (Our parameter id in the controller). And <em>numItems</em> is the total number of items. <em>PAGE_SIZE</em> is the number of items to be fetched from each requests.</p>
<p>Now we will create a function to calculate the length of the records.</p>
<p>[js]<br />
DynamicItems.prototype.getLength = function () {<br />
return this.numItems;<br />
};<br />
[/js]</p>
<p>This <em>numItems</em> can be set in the below function.</p>
<p>[js]<br />
DynamicItems.prototype.fetchNumItems_ = function () {<br />
$timeout(angular.noop, 300).then(angular.bind(this, function () {<br />
this.numItems = 1000;<br />
}));<br />
};<br />
[/js]</p>
<p>Here we are setting the <em>numItems </em> as 1000 for demo purposes, you can always get the count from database and assign it here with a $http request as we load the data from database here, you are yet to see that, no worries.</p>
<p>Below is the function to get the item by index.</p>
<p>[js]<br />
DynamicItems.prototype.getItemAtIndex = function (index) {<br />
var pageNumber = Math.floor(index / this.PAGE_SIZE);<br />
var page = this.loadedPages[pageNumber];</p>
<p>if (page) {<br />
return page[index % this.PAGE_SIZE];<br />
} else if (page !== null) {<br />
this.fetchPage_(pageNumber);<br />
}<br />
};<br />
[/js]</p>
<p>Here is the main part that to load the data from database using a $http service in Angular JS.</p>
<p>[js]<br />
DynamicItems.prototype.fetchPage_ = function (pageNumber) {<br />
this.loadedPages[pageNumber] = null;<br />
$timeout(angular.noop, 300).then(angular.bind(this, function () {<br />
var thisObj = this;<br />
this.loadedPages[pageNumber] = [];<br />
var pageOffset = pageNumber * this.PAGE_SIZE;<br />
var myData;<br />
var url = &#8221;;<br />
url = &#8216;api/DataAPI/&#8217; + pageOffset;<br />
$http({<br />
method: &#8216;GET&#8217;,<br />
url: url,<br />
}).then(function successCallback(response) {<br />
// this callback will be called asynchronously<br />
// when the response is available<br />
myData = JSON.parse(response.data);<br />
pushLoadPages(thisObj, myData)<br />
}, function errorCallback(response) {<br />
console.log(&#8216;Oops! Something went wrong while fetching the data. Status Code: &#8216; + response.status + &#8216; Status statusText: &#8216; + response.statusText);<br />
// called asynchronously if an error occurs<br />
// or server returns response with an error status.<br />
});<br />
}));<br />
};<br />
[/js]</p>
<p>As you can see calls our Web API ( <em>url = &#8216;api/DataAPI/&#8217; + pageOffset;</em>) from $http service, the callback function <em>successCallback</em> will get the data from database as a response. Once we get the response, we will pass the data to a function <em>pushLoadPages</em> to push the data items to the <em>loadedPages</em>. Cool right? Below is the code snippets for that function.</p>
<p>[js]<br />
function pushLoadPages(thisObj, servData) {<br />
if (servData != undefined) {<br />
for (var i = 0; i &lt; servData.length; i++) {<br />
thisObj.loadedPages[pageNumber].push(servData[i]);<br />
}<br />
}<br />
}<br />
[/js]</p>
<p>Here is the complete code for our Angular JS.</p>
<h3><strong>Angular JS Complete Code </strong></h3>
<p>[js]<br />
(function () {<br />
&#8216;use strict&#8217;;<br />
angular<br />
.module(&#8216;MyApp&#8217;, [&#8216;ngMaterial&#8217;, &#8216;ngMessages&#8217;, &#8216;material.svgAssetsCache&#8217;])<br />
.controller(&#8216;AppCtrl&#8217;, function ($http, $timeout) {<br />
var DynamicItems = function () {<br />
this.loadedPages = {};<br />
this.numItems = 0;<br />
this.PAGE_SIZE = 10;<br />
this.fetchNumItems_();<br />
};<br />
DynamicItems.prototype.getItemAtIndex = function (index) {<br />
var pageNumber = Math.floor(index / this.PAGE_SIZE);<br />
var page = this.loadedPages[pageNumber];</p>
<p>if (page) {<br />
return page[index % this.PAGE_SIZE];<br />
} else if (page !== null) {<br />
this.fetchPage_(pageNumber);<br />
}<br />
};<br />
DynamicItems.prototype.getLength = function () {<br />
return this.numItems;<br />
};<br />
DynamicItems.prototype.fetchPage_ = function (pageNumber) {<br />
this.loadedPages[pageNumber] = null;<br />
$timeout(angular.noop, 300).then(angular.bind(this, function () {<br />
var thisObj = this;<br />
this.loadedPages[pageNumber] = [];<br />
var pageOffset = pageNumber * this.PAGE_SIZE;<br />
var myData;<br />
var url = &#8221;;<br />
url = &#8216;api/DataAPI/&#8217; + pageOffset;<br />
$http({<br />
method: &#8216;GET&#8217;,<br />
url: url,<br />
}).then(function successCallback(response) {<br />
// this callback will be called asynchronously<br />
// when the response is available<br />
myData = JSON.parse(response.data);<br />
pushLoadPages(thisObj, myData)<br />
}, function errorCallback(response) {<br />
console.log(&#8216;Oops! Something went wrong while fetching the data. Status Code: &#8216; + response.status + &#8216; Status statusText: &#8216; + response.statusText);<br />
// called asynchronously if an error occurs<br />
// or server returns response with an error status.<br />
});<br />
function pushLoadPages(thisObj, servData) {<br />
if (servData != undefined) {<br />
for (var i = 0; i &lt; servData.length; i++) {<br />
thisObj.loadedPages[pageNumber].push(servData[i]);<br />
}<br />
}<br />
}<br />
}));<br />
};<br />
DynamicItems.prototype.fetchNumItems_ = function () {<br />
$timeout(angular.noop, 300).then(angular.bind(this, function () {<br />
this.numItems = 1000;<br />
}));<br />
};<br />
this.dynamicItems = new DynamicItems();<br />
});<br />
})();<br />
[/js]</p>
<p>Now it is time to see the output.</p>
<h2><strong>Output</strong></h2>
<div id="attachment_11299" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/02/Custom-Deffered-Grid-Using-MVC-Web-API-And-Angular-JS-Output.png"><img decoding="async" aria-describedby="caption-attachment-11299" class="size-large wp-image-11299" src="http://sibeeshpassion.com/wp-content/uploads/2016/02/Custom-Deffered-Grid-Using-MVC-Web-API-And-Angular-JS-Output-1024x577.png" alt="Custom Deffered Grid Using MVC Web API And Angular JS Output" width="634" height="357" srcset="/wp-content/uploads/2016/02/Custom-Deffered-Grid-Using-MVC-Web-API-And-Angular-JS-Output-1024x577.png 1024w, /wp-content/uploads/2016/02/Custom-Deffered-Grid-Using-MVC-Web-API-And-Angular-JS-Output-300x169.png 300w, /wp-content/uploads/2016/02/Custom-Deffered-Grid-Using-MVC-Web-API-And-Angular-JS-Output-768x433.png 768w, /wp-content/uploads/2016/02/Custom-Deffered-Grid-Using-MVC-Web-API-And-Angular-JS-Output-400x226.png 400w, /wp-content/uploads/2016/02/Custom-Deffered-Grid-Using-MVC-Web-API-And-Angular-JS-Output-1064x600.png 1064w, /wp-content/uploads/2016/02/Custom-Deffered-Grid-Using-MVC-Web-API-And-Angular-JS-Output.png 1135w" sizes="(max-width: 634px) 100vw, 634px" /></a><p id="caption-attachment-11299" class="wp-caption-text">Custom Deferred Grid Using MVC Web API And Angular JS Output</p></div>
<div id="attachment_11300" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/02/Custom-Deffered-Grid-Using-MVC-Web-API-And-Angular-JS-Deferred-Output.png"><img decoding="async" aria-describedby="caption-attachment-11300" class="size-large wp-image-11300" src="http://sibeeshpassion.com/wp-content/uploads/2016/02/Custom-Deffered-Grid-Using-MVC-Web-API-And-Angular-JS-Deferred-Output-1024x572.png" alt="Custom Deffered Grid Using MVC Web API And Angular JS Deferred Output" width="634" height="354" srcset="/wp-content/uploads/2016/02/Custom-Deffered-Grid-Using-MVC-Web-API-And-Angular-JS-Deferred-Output-1024x572.png 1024w, /wp-content/uploads/2016/02/Custom-Deffered-Grid-Using-MVC-Web-API-And-Angular-JS-Deferred-Output-300x168.png 300w, /wp-content/uploads/2016/02/Custom-Deffered-Grid-Using-MVC-Web-API-And-Angular-JS-Deferred-Output-768x429.png 768w, /wp-content/uploads/2016/02/Custom-Deffered-Grid-Using-MVC-Web-API-And-Angular-JS-Deferred-Output-400x223.png 400w, /wp-content/uploads/2016/02/Custom-Deffered-Grid-Using-MVC-Web-API-And-Angular-JS-Deferred-Output-1074x600.png 1074w, /wp-content/uploads/2016/02/Custom-Deffered-Grid-Using-MVC-Web-API-And-Angular-JS-Deferred-Output.png 1137w" sizes="(max-width: 634px) 100vw, 634px" /></a><p id="caption-attachment-11300" class="wp-caption-text">Custom Deferred Grid Using MVC Web API And Angular JS Deferred Output</p></div>
<p>Have a happy coding.</p>
<h2><strong>Reference</strong></h2>
<ul>
<li><a href="https://material.angularjs.org/latest/" target="_blank" rel="noopener">Angular JS Materials </a></li>
</ul>
<h2><strong>Conclusion</strong></h2>
<p>Did I miss anything that you may think which is needed? Did you try Web API yet? Have you ever wanted to do this requirement? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<h2><strong>Your turn. What do you think?</strong></h2>
<p>A blog isn&#8217;t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on Stack Overflow instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/custom-deferred-grid-using-mvc-web-api-and-angular-js/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Convert JSON Data Into Data Grid Columns</title>
		<link>https://mail.sibeeshpassion.com/convert-json-data-into-data-grid-columns/</link>
					<comments>https://mail.sibeeshpassion.com/convert-json-data-into-data-grid-columns/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Tue, 19 Jan 2016 09:00:37 +0000</pubDate>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[Bind JSON to Grid]]></category>
		<category><![CDATA[Client Side Grid]]></category>
		<category><![CDATA[Grid]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=11131</guid>

					<description><![CDATA[In this post we will see how we can show our JSON data in a client side grid. Here we are going to use jquery.columns grid, which is light weight and pretty easy to use. For the demo purpose we will create a JSON dynamically in client side and format it as a grid. I hope you will like this. Using the code First of all you need to download the needed files from here. Then add reference to your page. [html] &#60;link href=&#34;css/classic.css&#34; rel=&#34;stylesheet&#34; /&#62; &#60;script src=&#34;js/jquery.min.js&#34;&#62;&#60;/script&#62; &#60;script src=&#34;js/jquery.columns-1.0.min.js&#34;&#62;&#60;/script&#62; [/html] Creating a JSON dynamically You can create a JSON [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this post we will see how we can show our JSON data in a client side grid. Here we are going to use <em>jquery.columns</em> grid, which is light weight and pretty easy to use. For the demo purpose we will create a JSON dynamically in client side and format it as a grid. I hope you will like this. </p>
<p><strong>Using the code</strong></p>
<p>First of all you need to download the needed files from <a href="http://www.jqueryscript.net/table/jQuery-Plugin-To-Convert-JSON-Data-Into-Data-Grid-Columns.html" target="_blank">here</a>.</p>
<p>Then add reference to your page.</p>
<p>[html]<br />
  &lt;link href=&quot;css/classic.css&quot; rel=&quot;stylesheet&quot; /&gt;<br />
    &lt;script src=&quot;js/jquery.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;js/jquery.columns-1.0.min.js&quot;&gt;&lt;/script&gt;<br />
[/html]</p>
<p><strong>Creating a JSON dynamically </strong></p>
<p>You can create a JSON array as follows. </p>
<p>[js]<br />
var myData = new Array();<br />
        var firstNames =<br />
        [<br />
            &quot;Andrew&quot;, &quot;Nancy&quot;, &quot;Shelley&quot;, &quot;Regina&quot;, &quot;Yoshi&quot;, &quot;Antoni&quot;, &quot;Mayumi&quot;, &quot;Ian&quot;, &quot;Peter&quot;, &quot;Lars&quot;, &quot;Petra&quot;, &quot;Martin&quot;, &quot;Sven&quot;, &quot;Elio&quot;, &quot;Beate&quot;, &quot;Cheryl&quot;, &quot;Michael&quot;, &quot;Guylene&quot;<br />
        ];<br />
        var lastNames =<br />
        [<br />
            &quot;Fuller&quot;, &quot;Davolio&quot;, &quot;Burke&quot;, &quot;Murphy&quot;, &quot;Nagase&quot;, &quot;Saavedra&quot;, &quot;Ohno&quot;, &quot;Devling&quot;, &quot;Wilson&quot;, &quot;Peterson&quot;, &quot;Winkler&quot;, &quot;Bein&quot;, &quot;Petersen&quot;, &quot;Rossi&quot;, &quot;Vileid&quot;, &quot;Saylor&quot;, &quot;Bjorn&quot;, &quot;Nodier&quot;<br />
        ];<br />
        var productNames =<br />
        [<br />
            &quot;Black Tea&quot;, &quot;Green Tea&quot;, &quot;Caffe Espresso&quot;, &quot;Doubleshot Espresso&quot;, &quot;Caffe Latte&quot;, &quot;White Chocolate Mocha&quot;, &quot;Cramel Latte&quot;, &quot;Caffe Americano&quot;, &quot;Cappuccino&quot;, &quot;Espresso Truffle&quot;, &quot;Espresso con Panna&quot;, &quot;Peppermint Mocha Twist&quot;<br />
        ];<br />
        var priceValues =<br />
        [<br />
            &quot;2.25&quot;, &quot;1.5&quot;, &quot;3.0&quot;, &quot;3.3&quot;, &quot;4.5&quot;, &quot;3.6&quot;, &quot;3.8&quot;, &quot;2.5&quot;, &quot;5.0&quot;, &quot;1.75&quot;, &quot;3.25&quot;, &quot;4.0&quot;<br />
        ];<br />
 function createData(num) {<br />
            myData = [];<br />
            for (var i = 0; i &lt; num; i++) {<br />
                var row = {};<br />
                var productindex = Math.floor(Math.random() * productNames.length);<br />
                var price = parseFloat(priceValues[productindex]);<br />
                var quantity = 1 + Math.round(Math.random() * 10);<br />
                row[&quot;firstname&quot;] = firstNames[Math.floor(Math.random() * firstNames.length)];<br />
                row[&quot;lastname&quot;] = lastNames[Math.floor(Math.random() * lastNames.length)];<br />
                row[&quot;productname&quot;] = productNames[productindex];<br />
                row[&quot;price&quot;] = price;<br />
                row[&quot;quantity&quot;] = quantity;<br />
                row[&quot;total&quot;] = price * quantity;<br />
                myData[i] = row;<br />
            }<br />
        }<br />
[/js]</p>
<p>Here the function <em>createData</em> will create a JSON array.</p>
<p>Next we need to create a table and give this array as a data source to the grid. </p>
<p>[html]<br />
&lt;table id=&quot;dataGrid&quot; class=&quot;display&quot; width=&quot;100%&quot;&gt;&lt;/table&gt;<br />
[/html]</p>
<p>[js]<br />
$(function () {<br />
            createData(25);<br />
            $(&#8216;#dataGrid&#8217;).columns({<br />
                data: myData<br />
            });<br />
        });<br />
[/js]</p>
<p>Pretty simple right? </p>
<p><strong>Complete code</strong></p>
<p>[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br />
&lt;head&gt;<br />
    &lt;title&gt;Convert JSON Data Into Data Grid Columns&lt;/title&gt;<br />
    &lt;link href=&quot;css/classic.css&quot; rel=&quot;stylesheet&quot; /&gt;<br />
    &lt;script src=&quot;js/jquery.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script src=&quot;js/jquery.columns-1.0.min.js&quot;&gt;&lt;/script&gt;<br />
    &lt;script&gt;<br />
        var myData = new Array();<br />
        var firstNames =<br />
        [<br />
            &quot;Andrew&quot;, &quot;Nancy&quot;, &quot;Shelley&quot;, &quot;Regina&quot;, &quot;Yoshi&quot;, &quot;Antoni&quot;, &quot;Mayumi&quot;, &quot;Ian&quot;, &quot;Peter&quot;, &quot;Lars&quot;, &quot;Petra&quot;, &quot;Martin&quot;, &quot;Sven&quot;, &quot;Elio&quot;, &quot;Beate&quot;, &quot;Cheryl&quot;, &quot;Michael&quot;, &quot;Guylene&quot;<br />
        ];<br />
        var lastNames =<br />
        [<br />
            &quot;Fuller&quot;, &quot;Davolio&quot;, &quot;Burke&quot;, &quot;Murphy&quot;, &quot;Nagase&quot;, &quot;Saavedra&quot;, &quot;Ohno&quot;, &quot;Devling&quot;, &quot;Wilson&quot;, &quot;Peterson&quot;, &quot;Winkler&quot;, &quot;Bein&quot;, &quot;Petersen&quot;, &quot;Rossi&quot;, &quot;Vileid&quot;, &quot;Saylor&quot;, &quot;Bjorn&quot;, &quot;Nodier&quot;<br />
        ];<br />
        var productNames =<br />
        [<br />
            &quot;Black Tea&quot;, &quot;Green Tea&quot;, &quot;Caffe Espresso&quot;, &quot;Doubleshot Espresso&quot;, &quot;Caffe Latte&quot;, &quot;White Chocolate Mocha&quot;, &quot;Cramel Latte&quot;, &quot;Caffe Americano&quot;, &quot;Cappuccino&quot;, &quot;Espresso Truffle&quot;, &quot;Espresso con Panna&quot;, &quot;Peppermint Mocha Twist&quot;<br />
        ];<br />
        var priceValues =<br />
        [<br />
            &quot;2.25&quot;, &quot;1.5&quot;, &quot;3.0&quot;, &quot;3.3&quot;, &quot;4.5&quot;, &quot;3.6&quot;, &quot;3.8&quot;, &quot;2.5&quot;, &quot;5.0&quot;, &quot;1.75&quot;, &quot;3.25&quot;, &quot;4.0&quot;<br />
        ];<br />
        $(function () {<br />
            createData(25);<br />
            $(&#8216;#dataGrid&#8217;).columns({<br />
                data: myData<br />
            });<br />
        });<br />
        function createData(num) {<br />
            myData = [];<br />
            for (var i = 0; i &lt; num; i++) {<br />
                var row = {};<br />
                var productindex = Math.floor(Math.random() * productNames.length);<br />
                var price = parseFloat(priceValues[productindex]);<br />
                var quantity = 1 + Math.round(Math.random() * 10);<br />
                row[&quot;firstname&quot;] = firstNames[Math.floor(Math.random() * firstNames.length)];<br />
                row[&quot;lastname&quot;] = lastNames[Math.floor(Math.random() * lastNames.length)];<br />
                row[&quot;productname&quot;] = productNames[productindex];<br />
                row[&quot;price&quot;] = price;<br />
                row[&quot;quantity&quot;] = quantity;<br />
                row[&quot;total&quot;] = price * quantity;<br />
                myData[i] = row;<br />
            }<br />
        }</p>
<p>    &lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
    &lt;table id=&quot;dataGrid&quot; class=&quot;display&quot; width=&quot;100%&quot;&gt;&lt;/table&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p><strong>Output</strong></p>
<p>If everything goes fine, you can see as an output in your page. </p>
<div id="attachment_11132" style="width: 644px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2016/01/JSON-Data-Into-Data-Grid.png"><img decoding="async" aria-describedby="caption-attachment-11132" src="http://sibeeshpassion.com/wp-content/uploads/2016/01/JSON-Data-Into-Data-Grid-1024x184.png" alt="JSON Data Into Data Grid" width="634" height="114" class="size-large wp-image-11132" srcset="/wp-content/uploads/2016/01/JSON-Data-Into-Data-Grid-1024x184.png 1024w, /wp-content/uploads/2016/01/JSON-Data-Into-Data-Grid-300x54.png 300w, /wp-content/uploads/2016/01/JSON-Data-Into-Data-Grid-768x138.png 768w, /wp-content/uploads/2016/01/JSON-Data-Into-Data-Grid-400x72.png 400w, /wp-content/uploads/2016/01/JSON-Data-Into-Data-Grid.png 634w" sizes="(max-width: 634px) 100vw, 634px" /></a><p id="caption-attachment-11132" class="wp-caption-text">JSON Data Into Data Grid</p></div>
<p><strong>Conclusion</strong></p>
<p>Did I miss anything that you may think which is needed? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<p><strong>Your turn. What do you think?</strong></p>
<p>A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/convert-json-data-into-data-grid-columns/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Working With JQX Grid With Filtering And Sorting And Searching</title>
		<link>https://mail.sibeeshpassion.com/working-with-jqx-grid-with-filtering-and-sorting/</link>
					<comments>https://mail.sibeeshpassion.com/working-with-jqx-grid-with-filtering-and-sorting/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Sat, 29 Nov 2014 19:16:00 +0000</pubDate>
				<category><![CDATA[JQWidgets]]></category>
		<category><![CDATA[JQX Grid]]></category>
		<category><![CDATA[Client Side Grid]]></category>
		<category><![CDATA[Create JQX grid]]></category>
		<category><![CDATA[Fastest Client Side Grid]]></category>
		<category><![CDATA[Grid]]></category>
		<category><![CDATA[Grid Data Source]]></category>
		<category><![CDATA[Grid With Filter]]></category>
		<category><![CDATA[Grid With Searching]]></category>
		<category><![CDATA[Grid With Sorting]]></category>
		<category><![CDATA[Load Grid]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=531</guid>

					<description><![CDATA[Introduction We have all worked with JQ Grid. Today I got a requirement to implement JQWidget JQX Grid in my web application. Here I will explain how to implement JQX Grid in our application. Download the needed files JQX Grid With Filtering And Sorting This article has been selected as Asp.Net Community Article of the Day Tuesday, December 30, 2014 (Working with JQX Grid with Filtering and Sorting and Searching) What you must know jQuery : What is jQuery? JavaScript : JavaScript Tutorial CSS 3 : CSS3 Introduction HTML : HTML(5) Tutorial DOM Manipulations in jQuery : jQuery – DOM [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>We have all worked with JQ Grid. Today I got a requirement to implement JQWidget JQX Grid in my web application. Here I will explain how to implement JQX Grid in our application.</p>
<p><strong>Download the needed files</strong></p>
<p><a href="https://github.com/Sibeesh/JQXGrid" target="_blank">JQX Grid With Filtering And Sorting</a></p>
<p><em>This article has been selected as Asp.Net Community Article of the Day Tuesday, December 30, 2014</em><br />
(Working with JQX Grid with Filtering and Sorting and Searching)</p>
<p><strong>What you must know</strong></p>
<p>jQuery : <a href="http://jquery.com/" target="_blank">What is jQuery?</a><br />
JavaScript : <a href="http://www.w3schools.com/js/" target="_blank">JavaScript Tutorial</a><br />
CSS 3 : <a href="http://www.w3schools.com/css/css3_intro.asp" target="_blank">CSS3 Introduction</a><br />
HTML : <a href="http://www.w3schools.com/html/" target="_blank">HTML(5) Tutorial</a><br />
DOM Manipulations in jQuery : <a href="http://www.tutorialspoint.com/jquery/jquery-dom.htm" target="_blank">jQuery – DOM Manipulation Methods</a></p>
<p><strong>Background</strong></p>
<p>We can implement the JQX Grid in MVC and in our web application. You can find the demo here: <a href="http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/index.htm#demos/jqxgrid/filterconditions.htm" target="_blank">jqxGrid</a>.</p>
<p>You can download the necessary file from <a href="http://www.jqwidgets.com/download/" target="_blank">http://www.jqwidgets.com/download/</a>.</p>
<p><strong>What made me choose JQX Grid</strong></p>
<p>What made me choose JQX Grid? The answer is simple. We have so many client-side grid providers (JQGrid, Telerik, JQX and so on). If you are not aware of those, please have a look at:<a href="http://www.sitepoint.com/10-jquery-grids/" target="_blank">http://www.sitepoint.com/10-jquery-grids/</a></p>
<p>But for my requirements the client needs a toggle panel in which the filtering conditions occur. When I searched, JQX Grid has the best performance. (Some others support the same features, but they were a little slow.)</p>
<p><strong>Using the code</strong></p>
<p>There is a procedure we must follow to implement the JQX in our application.</p>
<p>Step 1</p>
<p>Download all the necessary files.</p>
<p>Step 2</p>
<p>Create a new web application.</p>
<div id="attachment_8871" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2014/11/working-with-jqx-grid-with-filtering-and-sorting.jpg"><img decoding="async" aria-describedby="caption-attachment-8871" src="http://sibeeshpassion.com/wp-content/uploads/2014/11/working-with-jqx-grid-with-filtering-and-sorting.jpg" alt="Working With JQX Grid With Filtering And Sorting And Searching" width="650" height="766" class="size-full wp-image-8871" srcset="/wp-content/uploads/2014/11/working-with-jqx-grid-with-filtering-and-sorting.jpg 303w, /wp-content/uploads/2014/11/working-with-jqx-grid-with-filtering-and-sorting-255x300.jpg 255w, /wp-content/uploads/2014/11/working-with-jqx-grid-with-filtering-and-sorting-400x471.jpg 400w, /wp-content/uploads/2014/11/working-with-jqx-grid-with-filtering-and-sorting-509x600.jpg 509w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-8871" class="wp-caption-text">Working With JQX Grid With Filtering And Sorting And Searching</p></div>
<p>Step 3</p>
<p>Add the selected folders to your application.</p>
<div id="attachment_8881" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2014/11/working-with-jqx-grid-with-filtering-and-sorting2.jpg"><img decoding="async" aria-describedby="caption-attachment-8881" src="http://sibeeshpassion.com/wp-content/uploads/2014/11/working-with-jqx-grid-with-filtering-and-sorting2.jpg" alt="Working With JQX Grid With Filtering And Sorting And Searching" width="650" height="346" class="size-full wp-image-8881" srcset="/wp-content/uploads/2014/11/working-with-jqx-grid-with-filtering-and-sorting2.jpg 634w, /wp-content/uploads/2014/11/working-with-jqx-grid-with-filtering-and-sorting2-300x160.jpg 300w, /wp-content/uploads/2014/11/working-with-jqx-grid-with-filtering-and-sorting2-400x213.jpg 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-8881" class="wp-caption-text">Working With JQX Grid With Filtering And Sorting And Searching</p></div>
<p>Step 4</p>
<p>Add a new page.</p>
<p>[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html lang=“en”&gt;<br />
&lt;head&gt;<br />
&lt;/head&gt;<br />
&lt;body &gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p>Step 5</p>
<p>Add the style sheets and necessary JavaScript files.<br />
[html]<br />
&lt;link rel=“stylesheet” href=“jqwidgets/styles/jqx.base.css” type=“text/css” /&gt;<br />
    &lt;script type=“text/javascript” src=“scripts/jquery-1.11.1.min.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxcore.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxdata.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxbuttons.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxscrollbar.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxlistbox.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxdropdownlist.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxmenu.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxgrid.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxgrid.filter.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxgrid.sort.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxgrid.selection.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxpanel.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxcheckbox.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“scripts/demos.js”&gt;&lt;/script&gt;<br />
[/html]</p>
<p>(Make sure that you add the JavaScript files in order.)</p>
<p>Step 6</p>
<p>Create the DOM elements in which you want to show the JQX Grid.<br />
[html]<br />
&lt;div id=‘jqxWidget’ style=“font-size: 13px; font-family: Verdana; float: left;”&gt;<br />
       &lt;div id=“jqxgrid”&gt;<br />
       &lt;/div&gt;<br />
   &lt;/div&gt;<br />
[/html]</p>
<p>Step 7</p>
<p>Generate some dynamic JSON data so that you can easily generate the JQX Grid. You can get the data from the database and convert it to JSON. If you are unfamiliar with how to convert JSON then you can get it here: <a href="https://www.nuget.org/packages/newtonsoft.json/" target="_blank">Json.NET 6.0.6.</a></p>
<p>If you are not aware of how to add the newtonsoft and use it then please see this video. And please dont forget to rate his video. He has done good a job :).</p>
<p><a href="https://www.youtube.com/watch?v=76blDatESaA" target="_blank">JSON Serialization and DeSerialization</a></p>
<p>Here I am generating data dynamically in a JavaScript file. Please find the generatedata.js file in the bundle of the JQX Grid. Please add this to your script section.<br />
[js]<br />
&lt;script src=“generatedata.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
[/js]</p>
<p>If you go into the <em>generatedata.js</em>, you can see a function generatedata, that is for creating the data (JSON array) dynamically .<br />
[js]<br />
function generatedata(rowscount, hasNullValues) {<br />
    // prepare the data<br />
    var data = new Array();<br />
    if (rowscount == #ff0000) rowscount = 100;<br />
    var firstNames =<br />
    [<br />
        “Andrew”, “Nancy”, “Shelley”, “Regina”, “Yoshi”, “Antoni”, “Mayumi”, “Ian”, “Peter”, “Lars”, “Petra”, “Martin”, “Sven”, “Elio”, “Beate”, “Cheryl”, “Michael”, “Guylene”<br />
    ];<br />
    var lastNames =<br />
    [<br />
        “Fuller”, “Davolio”, “Burke”, “Murphy”, “Nagase”, “Saavedra”, “Ohno”, “Devling”, “Wilson”, “Peterson”, “Winkler”, “Bein”, “Petersen”, “Rossi”, “Vileid”, “Saylor”, “Bjorn”, “Nodier”<br />
    ];<br />
    var productNames =<br />
    [<br />
        “Black Tea”, “Green Tea”, “Caffe Espresso”, “Doubleshot Espresso”, “Caffe Latte”, “White Chocolate Mocha”, “Caramel Latte”, “Caffe Americano”, “Cappuccino”, “Espresso Truffle”, “Espresso con Panna”, “Peppermint Mocha Twist”<br />
    ];<br />
    var priceValues =<br />
    [<br />
         “2.25”, “1.5”, “3.0”, “3.3”, “4.5”, “3.6”, “3.8”, “2.5”, “5.0”, “1.75”, “3.25”, “4.0”<br />
    ];<br />
    for (var i = 0; i &lt; rowscount; i++) {<br />
        var row = {};<br />
        var productindex = Math.floor(Math.random() * productNames.length);<br />
        var price = parseFloat(priceValues[productindex]);<br />
        var quantity = 1 + Math.round(Math.random() * 10);<br />
        row[“id”] = i;<br />
        row[“available”] = productindex % 2 == 0;<br />
        if (hasNullValues == true) {<br />
            if (productindex % 2 != 0) {<br />
                var random = Math.floor(Math.random() * rowscount);<br />
                row[“available”] = i % random == 0 ? null : false;<br />
            }<br />
        }<br />
        row[“firstname”] = firstNames[Math.floor(Math.random() * firstNames.length)];<br />
        row[“lastname”] = lastNames[Math.floor(Math.random() * lastNames.length)];<br />
        row[“name”] = row[“firstname”] + ” “ + row[“lastname”];<br />
        row[“productname”] = productNames[productindex];<br />
        row[“price”] = price;<br />
        row[“quantity”] = quantity;<br />
        row[“total”] = price * quantity;<br />
        var date = new Date();<br />
        date.setFullYear(2014, Math.floor(Math.random() * 12), Math.floor(Math.random() * 27));<br />
        date.setHours(0, 0, 0, 0);<br />
        row[“date”] = date;<br />
        data[i] = row;<br />
    }<br />
    return data;<br />
}<br />
[/js]</p>
<p>Step 8 </p>
<p>Now here is the main part. Add the main code to your script tag in the page. Here we are appending the Grid to the element that has the id jqxgrid.<br />
[js]<br />
&lt;script type=“text/javascript”&gt;<br />
        $(document).ready(function () {<br />
            var data = generatedata(500);<br />
            var source =<br />
            {<br />
                localdata: data,<br />
                datafields:<br />
                [<br />
                    { name: ‘firstname’, type: ‘string’ },<br />
                    { name: ‘lastname’, type: ‘string’ },<br />
                    { name: ‘productname’, type: ‘string’ },<br />
                    { name: ‘date’, type: ‘date’ },<br />
                    { name: ‘quantity’, type: ‘number’ }<br />
                ],<br />
                datatype: “array”<br />
            };<br />
            var addfilter = function () {<br />
                var filtergroup = new $.jqx.filter();<br />
                var filter_or_operator = 1;<br />
                var filtervalue = ‘Beate’;<br />
                var filtercondition = ‘contains’;<br />
                var filter1 = filtergroup.createfilter(‘stringfilter’, filtervalue, filtercondition);<br />
                filtervalue = ‘Andrew’;<br />
                filtercondition = ‘contains’;<br />
                var filter2 = filtergroup.createfilter(‘stringfilter’, filtervalue, filtercondition);<br />
                filtergroup.addfilter(filter_or_operator, filter1);<br />
                filtergroup.addfilter(filter_or_operator, filter2);<br />
                // add the filters.<br />
                $(“#jqxgrid”).jqxGrid(‘addfilter’, ‘firstname’, filtergroup);<br />
                // apply the filters.<br />
                $(“#jqxgrid”).jqxGrid(‘applyfilters’);<br />
            }<br />
            var dataAdapter = new $.jqx.dataAdapter(source);<br />
            $(“#jqxgrid”).jqxGrid(<br />
            {<br />
                width: 850,<br />
                source: dataAdapter,<br />
                filterable: true,<br />
                sortable: true,<br />
                autoshowfiltericon: true,<br />
                ready: function () {<br />
                    addfilter();<br />
                    var localizationObject = {<br />
                        filterstringcomparisonoperators: [‘contains’, ‘does not contain’],<br />
                        // filter numeric comparison operators.<br />
                        filternumericcomparisonoperators: [‘less than’, ‘greater than’],<br />
                        // filter date comparison operators.<br />
                        filterdatecomparisonoperators: [‘less than’, ‘greater than’],<br />
                        // filter bool comparison operators.<br />
                        filterbooleancomparisonoperators: [‘equal’, ‘not equal’]<br />
                    }<br />
                    $(“#jqxgrid”).jqxGrid(‘localizestrings’, localizationObject);<br />
                },<br />
                updatefilterconditions: function (type, defaultconditions) {<br />
                    var stringcomparisonoperators = [‘CONTAINS’, ‘DOES_NOT_CONTAIN’];<br />
                    var numericcomparisonoperators = [‘LESS_THAN’, ‘GREATER_THAN’];<br />
                    var datecomparisonoperators = [‘LESS_THAN’, ‘GREATER_THAN’];<br />
                    var booleancomparisonoperators = [‘EQUAL’, ‘NOT_EQUAL’];<br />
                    switch (type) {<br />
                        case ‘stringfilter’:<br />
                            return stringcomparisonoperators;<br />
                        case ‘numericfilter’:<br />
                            return numericcomparisonoperators;<br />
                        case ‘datefilter’:<br />
                            return datecomparisonoperators;<br />
                        case ‘booleanfilter’:<br />
                            return booleancomparisonoperators;<br />
                    }<br />
                },<br />
                updatefilterpanel: function (filtertypedropdown1, filtertypedropdown2, filteroperatordropdown, filterinputfield1, filterinputfield2, filterbutton, clearbutton,<br />
                 columnfilter, filtertype, filterconditions) {<br />
                    var index1 = 0;<br />
                    var index2 = 0;<br />
                    if (columnfilter != null) {<br />
                        var filter1 = columnfilter.getfilterat(0);<br />
                        var filter2 = columnfilter.getfilterat(1);<br />
                        if (filter1) {<br />
                            index1 = filterconditions.indexOf(filter1.comparisonoperator);<br />
                            var value1 = filter1.filtervalue;<br />
                            filterinputfield1.val(value1);<br />
                        }<br />
                        if (filter2) {<br />
                            index2 = filterconditions.indexOf(filter2.comparisonoperator);<br />
                            var value2 = filter2.filtervalue;<br />
                            filterinputfield2.val(value2);<br />
                        }<br />
                    }<br />
                    filtertypedropdown1.jqxDropDownList({ autoDropDownHeight: true, selectedIndex: index1 });<br />
                    filtertypedropdown2.jqxDropDownList({ autoDropDownHeight: true, selectedIndex: index2 });<br />
                },<br />
                columns: [<br />
                  { text: ‘First Name’, datafield: ‘firstname’, width: 200 },<br />
                  { text: ‘Last Name’, datafield: ‘lastname’, width: 200 },<br />
                  { text: ‘Product’, datafield: ‘productname’, width: 180 },<br />
                  { text: ‘Order Date’, datafield: ‘date’, width: 160, cellsformat: ‘dd-MMMM-yyyy’ },<br />
                  { text: ‘Quantity’, datafield: ‘quantity’, cellsalign: ‘right’ }<br />
                ]<br />
            });<br />
            $(‘#events’).jqxPanel({ width: 300, height: 80});<br />
            $(“#jqxgrid”).on(“filter”, function (event) {<br />
                $(“#events”).jqxPanel(‘clearcontent’);<br />
                var filterinfo = $(“#jqxgrid”).jqxGrid(‘getfilterinformation’);<br />
                var eventData = “Triggered ‘filter’ event”;<br />
                for (i = 0; i &lt; filterinfo.length; i++) {<br />
                    var eventData = “Filter Column: “ + filterinfo[i].filtercolumntext;<br />
                    $(‘#events’).jqxPanel(‘prepend’, ‘&lt;div style=”margin-top: 5px;”&gt;’ + eventData + ‘&lt;/div&gt;’);<br />
                }<br />
            });<br />
            $(‘#clearfilteringbutton’).jqxButton({ theme: theme });<br />
            $(‘#filterbackground’).jqxCheckBox({ checked: true, height: 25});<br />
            $(‘#filtericons’).jqxCheckBox({ checked: false, height: 25});<br />
            // clear the filtering.<br />
            $(‘#clearfilteringbutton’).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘clearfilters’);<br />
            });<br />
            // show/hide filter background<br />
            $(‘#filterbackground’).on(‘change’, function (event) {<br />
                $(“#jqxgrid”).jqxGrid({ showfiltercolumnbackground: event.args.checked });<br />
            });<br />
            // show/hide filter icons<br />
            $(‘#filtericons’).on(‘change’, function (event) {<br />
                $(“#jqxgrid”).jqxGrid({ autoshowfiltericon: !event.args.checked });<br />
            });<br />
        });<br />
    &lt;/script&gt;<br />
[/js]</p>
<p>Step 9: Now build and run your code, you will get output as in the following:</p>
<div id="attachment_8891" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2014/11/working-with-jqx-grid-with-filtering-and-sorting3.jpg"><img decoding="async" aria-describedby="caption-attachment-8891" src="http://sibeeshpassion.com/wp-content/uploads/2014/11/working-with-jqx-grid-with-filtering-and-sorting3.jpg" alt="Working With JQX Grid With Filtering And Sorting And Searching" width="650" height="314" class="size-full wp-image-8891" srcset="/wp-content/uploads/2014/11/working-with-jqx-grid-with-filtering-and-sorting3.jpg 634w, /wp-content/uploads/2014/11/working-with-jqx-grid-with-filtering-and-sorting3-300x145.jpg 300w, /wp-content/uploads/2014/11/working-with-jqx-grid-with-filtering-and-sorting3-400x193.jpg 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-8891" class="wp-caption-text">Working With JQX Grid With Filtering And Sorting And Searching</p></div>
<p>Have a happy coding 🙂</p>
<p><strong>History</strong></p>
<p>First version on: 13-Oct-2014 10:30 PM.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/working-with-jqx-grid-with-filtering-and-sorting/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Advanced JQX Grid With All Functionality</title>
		<link>https://mail.sibeeshpassion.com/advanced-jqx-grid-with-all-functionality/</link>
					<comments>https://mail.sibeeshpassion.com/advanced-jqx-grid-with-all-functionality/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Wed, 29 Oct 2014 19:05:41 +0000</pubDate>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[JQWidgets]]></category>
		<category><![CDATA[JQX Grid]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[Advanced Grid]]></category>
		<category><![CDATA[Client Side Grid]]></category>
		<category><![CDATA[Grid]]></category>
		<category><![CDATA[HTML Grid]]></category>
		<category><![CDATA[JQwidget Property]]></category>
		<category><![CDATA[JSON Grid]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=431</guid>

					<description><![CDATA[In this article we will see how we can implement or create a JQWidget&#8217;s JQX grid in our application. It is a client side grid which is good in performance and speed. We will see the advanced properties of a JQWidget JQX gris in this article. This article has been selected as Asp.Net Community Article of the Day Sunday January 11 ,2015. If you are new to the term JQX Grid then please find out the articles related to JQWidget category here: http://sibeeshpassion.com/category/products/jqwidgets/ If you need to bind the data source dynamically, please read here: http://sibeeshpassion.com/Convert-CellSet-to-HTML-table-And-From-HTML-To-Json-To-Array. For the past days [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this article we will see how we can implement or create a JQWidget&#8217;s JQX grid in our application. It is a client side grid which is good in performance and speed. We will see the advanced properties of a JQWidget JQX gris in this article.</p>
<p><em>This article has been selected as <a href="http://asp.net/community/articles" target="_blank">Asp.Net Community Article of the Day</a> Sunday January 11 ,2015.</em></p>
<p>If you are new to the term JQX Grid then please find out the articles related to JQWidget category here: <a href="http://sibeeshpassion.com/category/products/jqwidgets/" target="_blank">http://sibeeshpassion.com/category/products/jqwidgets/</a></p>
<p>If you need to bind the data source dynamically, please read here: <a href="http://sibeeshpassion.com/Convert-CellSet-to-HTML-table-And-From-HTML-To-Json-To-Array" target="_blank">http://sibeeshpassion.com/Convert-CellSet-to-HTML-table-And-From-HTML-To-Json-To-Array</a>. For the past days I have been working on JQX Grid. Now I will share that Grid with all the functionality.</p>
<p><strong>Download the source code</strong></p>
<li><a href="https://code.msdn.microsoft.com/Advanced-JQX-Grid-With-All-37dccb56" target="_blank">Advanced JQXGrid </a></li>
<p><strong>Background</strong></p>
<p>In my previous article, one member asked for some functionality. So I thought of sharing that info. Please note that I have not implemented all the functionalities. I have selected some important features that we may use in our programming life.</p>
<p><strong>Using the code</strong></p>
<p>As we discussed in the previous articles, we need a web application with all the contents of JQX Widgets (<a href="http://sibeeshpassion.com/working-with-jqx-grid-with-filtering-and-sorting/" target="_blank">http://sibeeshpassion.com/working-with-jqx-grid-with-filtering-and-sorting/</a> ).</p>
<p><strong>What is JQX Grid?</strong></p>
<p>jqxGrid is powerful datagrid widget built entirely with open web standards. It offers rich functionality, easy to use APIs and works across devices and browsers. jqxGrid delivers advanced data visualization features and built-in support for client and server-side paging, editing, sorting and filtering.</p>
<p><strong>What we need?</strong></p>
<p><em>Simple HTML</em><br />
[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html lang=“en”&gt;<br />
   &lt;head&gt;<br />
       &lt;title&gt;&lt;/title&gt;<br />
   &lt;/head&gt;<br />
   &lt;body&gt;<br />
   &lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p><strong>Include the extra UI elements</strong><br />
[html]<br />
&lt;body class=‘default’&gt;<br />
    &lt;div id=‘jqxWidget’ style=“font-size: 13px; font-family: Verdana; float: left;”&gt;<br />
        &lt;div id=“jqxgrid”&gt;&lt;/div&gt;<br />
        &lt;div style=‘margin-top: 20px;’&gt;<br />
            &lt;div style=‘float: left;’&gt;<br />
                &lt;input type=“button” value=“Export to Excel” id=‘excelExport’ /&gt;<br />
                &lt;br /&gt;&lt;br /&gt;<br />
                &lt;input type=“button” value=“Export to XML” id=‘xmlExport’ /&gt;<br />
            &lt;/div&gt;<br />
            &lt;div style=‘margin-left: 10px; float: left;’&gt;<br />
                &lt;input type=“button” value=“Export to CSV” id=‘csvExport’ /&gt;<br />
                &lt;br /&gt;&lt;br /&gt;<br />
                &lt;input type=“button” value=“Export to TSV” id=‘tsvExport’ /&gt;<br />
            &lt;/div&gt;<br />
            &lt;div style=‘margin-left: 10px; float: left;’&gt;<br />
                &lt;input type=“button” value=“Export to HTML” id=‘htmlExport’ /&gt;<br />
                &lt;br /&gt;&lt;br /&gt;<br />
                &lt;input type=“button” value=“Export to JSON” id=‘jsonExport’ /&gt;<br />
            &lt;/div&gt;<br />
            &lt;div style=‘margin-left: 10px; float: left;’&gt;<br />
                &lt;input type=“button” value=“Print” id=‘print’ /&gt;<br />
            &lt;/div&gt;<br />
        &lt;/div&gt;<br />
    &lt;/div&gt;<br />
&lt;/body&gt;<br />
[/html]</p>
<p><strong>Include Reference</strong></p>
<p>[html]<br />
&lt;link rel=“stylesheet” href=“jqwidgets/styles/jqx.base.css” type=“text/css” /&gt;<br />
    &lt;script type=“text/javascript” src=“scripts/jquery-1.11.1.min.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxcore.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxdata.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxbuttons.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxscrollbar.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxlistbox.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxdropdownlist.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxmenu.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxgrid.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxgrid.filter.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxgrid.sort.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxgrid.selection.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxpanel.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxcheckbox.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“scripts/demos.js”&gt;&lt;/script&gt;<br />
    &lt;script src=“jqwidgets/jqxgrid.pager.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
    &lt;script src=“jqwidgets/jqxgrid.edit.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
    &lt;script src=“jqwidgets/jqxgrid.columnsresize.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
    &lt;script src=“jqwidgets/jqxgrid.columnsreorder.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
    &lt;script src=“jqwidgets/jqxgrid.export.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
    &lt;script src=“jqwidgets/jqxdata.export.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
[/html]</p>
<p><strong>What we add new?</strong><br />
[js]<br />
&lt;script src=“jqwidgets/jqxgrid.pager.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
[/js]</p>
<p>This script is for adding the functionality of Paging :). You can add the functionality to the grid as<br />
[js]<br />
pageable: true.<br />
[/js]</p>
<p>And if you want different stylish paging then you can set that like this:<br />
[js]<br />
pagermode: ‘simple’,<br />
[/js]<br />
[js]<br />
&lt;script src=“jqwidgets/jqxgrid.edit.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
[/js]</p>
<p>This script is for adding the functionality of Editing :). You can add the functionality to the grid as<br />
[js]<br />
editable: true.<br />
[/js]<br />
[js]<br />
&lt;script src=“jqwidgets/jqxgrid.columnsresize.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
&lt;script src=“jqwidgets/jqxgrid.columnsreorder.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
[/js]</p>
<p>These scripts are for adding the functionality of Hierarchy columns. If we want to separate the data in the column header then you can include the following scripts.<br />
[js]<br />
&lt;script src=“jqwidgets/jqxgrid.export.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
&lt;script src=“jqwidgets/jqxdata.export.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
[/js]</p>
<p>When you want to export your grid to any formate, please include those scripts. You can implement the same just like the following:<br />
[js]<br />
$(“#excelExport”).jqxButton({ theme: theme }); //Assign styles to the button<br />
            $(“#xmlExport”).jqxButton({ theme: theme });<br />
            $(“#csvExport”).jqxButton({ theme: theme });<br />
            $(“#tsvExport”).jqxButton({ theme: theme });<br />
            $(“#htmlExport”).jqxButton({ theme: theme });<br />
            $(“#jsonExport”).jqxButton({ theme: theme });<br />
            $(“#excelExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘xls’, ‘jqxGrid’); // To export to xlx<br />
            });<br />
            $(“#xmlExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘xml’, ‘jqxGrid’); //To export to XML<br />
            });<br />
            $(“#csvExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘csv’, ‘jqxGrid’); // To export to csv<br />
            });<br />
            $(“#tsvExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘tsv’, ‘jqxGrid’); // To export to tsv<br />
            });<br />
            $(“#htmlExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘html’, ‘jqxGrid’); // To export to html<br />
            });<br />
            $(“#jsonExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘json’, ‘jqxGrid’); // To export to JSON<br />
            });<br />
[/js]</p>
<p>If you want to print your grid:<br />
[js]<br />
$(“#print”).jqxButton();<br />
            $(“#print”).click(function () {<br />
                var gridContent = $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘html’);<br />
                var newWindow = window.open(”, ”, ‘width=800, height=500′),<br />
                document = newWindow.document.open(),<br />
                pageContent =<br />
                    ‘&lt;!DOCTYPE html&gt;\n’ +<br />
                    ‘&lt;html&gt;\n’ +<br />
                    ‘&lt;head&gt;\n’ +<br />
                    ‘&lt;meta charset=”utf-8″ /&gt;\n’ +<br />
                    ‘&lt;title&gt;jQWidgets Grid&lt;/title&gt;\n’ +<br />
                    ‘&lt;/head&gt;\n’ +<br />
                    ‘&lt;body&gt;\n’ + gridContent + ‘\n&lt;/body&gt;\n&lt;/html&gt;’;<br />
                document.write(pageContent);<br />
                document.close();<br />
                newWindow.print();<br />
            });<br />
[/js]</p>
<p>Now we need data to populate the grid, right? Since we are familiar with a simple header JQX Grid from the previous article, now we can go for a hierarchy column grid. So let’s say we have XML as follows:</p>
<p>[xml]<br />
&lt;DATA&gt;<br />
    &lt;ROW&gt;<br />
        &lt;ProductID&gt;72&lt;/ProductID&gt;<br />
        &lt;SupplierName&gt;Formaggi Fortini s.r.l.&lt;/SupplierName&gt;<br />
        &lt;Quantity&gt;24 – 200 g pkgs.&lt;/Quantity&gt;<br />
        &lt;Freight&gt;32.3800&lt;/Freight&gt;<br />
        &lt;OrderDate&gt;1996-07-04 00:00:00&lt;/OrderDate&gt;<br />
        &lt;OrderAddress&gt;59 rue de l-Abbaye&lt;/OrderAddress&gt;<br />
        &lt;Price&gt;34.8000&lt;/Price&gt;<br />
        &lt;City&gt;Ravenna&lt;/City&gt;<br />
        &lt;Address&gt;Viale Dante, 75&lt;/Address&gt;<br />
        &lt;ProductName&gt;Mozzarella di Giovanni&lt;/ProductName&gt;<br />
    &lt;/ROW&gt;<br />
    &lt;ROW&gt;<br />
        &lt;ProductID&gt;42&lt;/ProductID&gt;<br />
        &lt;SupplierName&gt;Leka Trading&lt;/SupplierName&gt;<br />
        &lt;Quantity&gt;32 – 1 kg pkgs.&lt;/Quantity&gt;<br />
        &lt;Freight&gt;32.3800&lt;/Freight&gt;<br />
        &lt;OrderDate&gt;1996-07-04 00:00:00&lt;/OrderDate&gt;<br />
        &lt;OrderAddress&gt;59 rue de l-Abbaye&lt;/OrderAddress&gt;<br />
        &lt;Price&gt;14.0000&lt;/Price&gt;<br />
        &lt;City&gt;Singapore&lt;/City&gt;<br />
        &lt;Address&gt;471 Serangoon Loop, Suite #402&lt;/Address&gt;<br />
        &lt;ProductName&gt;Singaporean Hokkien Fried Mee&lt;/ProductName&gt;<br />
    &lt;/ROW&gt;<br />
    &lt;ROW&gt;<br />
        ……..<br />
    &lt;/ROW&gt;<br />
    &lt;ROW&gt;<br />
       ……..<br />
    &lt;/ROW&gt;<br />
&lt;/DATA&gt;<br />
[/xml]</p>
<p>Please find the <em>orderdetailsextended.xml</em> from the source.</p>
<p><strong>Implementing a JQX GRid with advanced features</strong><br />
[js]<br />
&lt;script type=“text/javascript”&gt;<br />
         $(document).ready(function () {<br />
             // prepare the data<br />
             var source =<br />
            {<br />
                datatype: “xml”,<br />
                datafields: [<br />
                     { name: ‘SupplierName’, type: ‘string’ },<br />
                     { name: ‘Quantity’, type: ‘number’ },<br />
                     { name: ‘OrderDate’, type: ‘date’ },<br />
                     { name: ‘OrderAddress’, type: ‘string’ },<br />
                     { name: ‘Freight’, type: ‘number’ },<br />
                     { name: ‘Price’, type: ‘number’ },<br />
                     { name: ‘City’, type: ‘string’ },<br />
                     { name: ‘ProductName’, type: ‘string’ },<br />
                     { name: ‘Address’, type: ‘string’ }<br />
                ],<br />
                url: ‘orderdetailsextended.xml’,<br />
                root: ‘DATA’,<br />
                record: ‘ROW’<br />
            };<br />
             var dataAdapter = new $.jqx.dataAdapter(source, {<br />
                 loadComplete: function () {<br />
                 }<br />
             });<br />
             // create jqxgrid.<br />
             $(“#jqxgrid”).jqxGrid(<br />
            {<br />
                width: 900,<br />
                source: dataAdapter,<br />
                filterable: true,<br />
                sortable: true,<br />
                pageable: true,<br />
                autorowheight: true,<br />
                altrows: true,<br />
                columnsresize: true,<br />
                columns: [<br />
                  { text: ‘Supplier Name’, cellsalign: ‘center’, align: ‘center’, datafield: ‘SupplierName’, width: 110 },<br />
                  { text: ‘Name’, columngroup: ‘ProductDetails’, cellsalign: ‘center’, align: ‘center’, datafield: ‘ProductName’, width: 120 },<br />
                  { text: ‘Quantity’, columngroup: ‘ProductDetails’, datafield: ‘Quantity’, cellsformat: ‘d’, cellsalign: ‘center’, align: ‘center’, width: 80 },<br />
                  { text: ‘Freight’, columngroup: ‘OrderDetails’, datafield: ‘Freight’, cellsformat: ‘d’, cellsalign: ‘center’, align: ‘center’, width: 100 },<br />
                  { text: ‘Order Date’, columngroup: ‘OrderDetails’, cellsalign: ‘center’, align: ‘center’, cellsformat: ‘d’, datafield: ‘OrderDate’, width: 100 },<br />
                  { text: ‘Order Address’, columngroup: ‘OrderDetails’, cellsalign: ‘center’, align: ‘center’, datafield: ‘OrderAddress’, width: 100 },<br />
                  { text: ‘Price’, columngroup: ‘ProductDetails’, datafield: ‘Price’, cellsformat: ‘c2′, align: ‘center’, cellsalign: ‘center’, width: 70 },<br />
                  { text: ‘Address’, columngroup: ‘Location’, cellsalign: ‘center’, align: ‘center’, datafield: ‘Address’, width: 120 },<br />
                  { text: ‘City’, columngroup: ‘Location’, cellsalign: ‘center’, align: ‘center’, datafield: ‘City’, width: 80 }<br />
                ],<br />
                columngroups:<br />
                [<br />
                  { text: ‘Product Details’, align: ‘center’, name: ‘ProductDetails’ },<br />
                  { text: ‘Order Details’, parentgroup: ‘ProductDetails’, align: ‘center’, name: ‘OrderDetails’ },<br />
                  { text: ‘Location’, align: ‘center’, name: ‘Location’ }<br />
                ]<br />
            });<br />
            $(“#excelExport”).jqxButton({ theme: theme });<br />
            $(“#xmlExport”).jqxButton({ theme: theme });<br />
            $(“#csvExport”).jqxButton({ theme: theme });<br />
            $(“#tsvExport”).jqxButton({ theme: theme });<br />
            $(“#htmlExport”).jqxButton({ theme: theme });<br />
            $(“#jsonExport”).jqxButton({ theme: theme });<br />
            $(“#excelExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘xls’, ‘jqxGrid’);<br />
            });<br />
            $(“#xmlExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘xml’, ‘jqxGrid’);<br />
            });<br />
            $(“#csvExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘csv’, ‘jqxGrid’);<br />
            });<br />
            $(“#tsvExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘tsv’, ‘jqxGrid’);<br />
            });<br />
            $(“#htmlExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘html’, ‘jqxGrid’);<br />
            });<br />
            $(“#jsonExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘json’, ‘jqxGrid’);<br />
            });<br />
            $(“#print”).jqxButton();<br />
            $(“#print”).click(function () {<br />
                var gridContent = $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘html’);<br />
                var newWindow = window.open(”, ”, ‘width=800, height=500′),<br />
                document = newWindow.document.open(),<br />
                pageContent =<br />
                    ‘&lt;!DOCTYPE html&gt;\n’ +<br />
                    ‘&lt;html&gt;\n’ +<br />
                    ‘&lt;head&gt;\n’ +<br />
                    ‘&lt;meta charset=”utf-8″ /&gt;\n’ +<br />
                    ‘&lt;title&gt;jQWidgets Grid&lt;/title&gt;\n’ +<br />
                    ‘&lt;/head&gt;\n’ +<br />
                    ‘&lt;body&gt;\n’ + gridContent + ‘\n&lt;/body&gt;\n&lt;/html&gt;’;<br />
                document.write(pageContent);<br />
                document.close();<br />
                newWindow.print();<br />
            });<br />
         });<br />
    &lt;/script&gt;<br />
[/js]</p>
<p>In the preceding script you can see a code part as follows:<br />
[js]<br />
columngroups:<br />
               [<br />
                  { text: ‘Product Details’, align: ‘center’, name: ‘ProductDetails’ },<br />
                  { text: ‘Order Details’, parentgroup: ‘ProductDetails’, align: ‘center’, name: ‘OrderDetails’ },<br />
                  { text: ‘Location’, align: ‘center’, name: ‘Location’ }<br />
               ]<br />
[/js]</p>
<p>This is where the column grouping is happening. And if you want to add a column under this column you can set that as follows:<br />
[js]<br />
{ text: ‘Name’, columngroup: ‘ProductDetails’, cellsalign: ‘center’, align: ‘center’, datafield: ‘ProductName’, width: 120 }<br />
[/js]</p>
<p>You can specify this as needed and your data source.Now this is how our page looks like.<br />
[html]<br />
&lt;!DOCTYPE html&gt;<br />
&lt;html lang=“en”&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;&lt;/title&gt;<br />
    &lt;link rel=“stylesheet” href=“jqwidgets/styles/jqx.base.css” type=“text/css” /&gt;<br />
    &lt;script type=“text/javascript” src=“scripts/jquery-1.11.1.min.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxcore.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxdata.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxbuttons.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxscrollbar.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxlistbox.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxdropdownlist.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxmenu.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxgrid.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxgrid.filter.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxgrid.sort.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxgrid.selection.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxpanel.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“jqwidgets/jqxcheckbox.js”&gt;&lt;/script&gt;<br />
    &lt;script type=“text/javascript” src=“scripts/demos.js”&gt;&lt;/script&gt;<br />
    &lt;script src=“generatedata.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
    &lt;script src=“jqwidgets/jqxgrid.pager.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
    &lt;script src=“jqwidgets/jqxgrid.edit.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
    &lt;script src=“jqwidgets/jqxgrid.columnsresize.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
    &lt;script src=“jqwidgets/jqxgrid.columnsreorder.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
    &lt;script src=“jqwidgets/jqxgrid.export.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
    &lt;script src=“jqwidgets/jqxdata.export.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
     &lt;script type=“text/javascript”&gt;<br />
         $(document).ready(function () {<br />
             // prepare the data<br />
             var source =<br />
            {<br />
                datatype: “xml”,<br />
                datafields: [<br />
                     { name: ‘SupplierName’, type: ‘string’ },<br />
                     { name: ‘Quantity’, type: ‘number’ },<br />
                     { name: ‘OrderDate’, type: ‘date’ },<br />
                     { name: ‘OrderAddress’, type: ‘string’ },<br />
                     { name: ‘Freight’, type: ‘number’ },<br />
                     { name: ‘Price’, type: ‘number’ },<br />
                     { name: ‘City’, type: ‘string’ },<br />
                     { name: ‘ProductName’, type: ‘string’ },<br />
                     { name: ‘Address’, type: ‘string’ }<br />
                ],<br />
                url: ‘orderdetailsextended.xml’,<br />
                root: ‘DATA’,<br />
                record: ‘ROW’<br />
            };<br />
             var dataAdapter = new $.jqx.dataAdapter(source, {<br />
                 loadComplete: function () {<br />
                 }<br />
             });<br />
             // create jqxgrid.<br />
             $(“#jqxgrid”).jqxGrid(<br />
            {<br />
                width: 900,<br />
                source: dataAdapter,<br />
                filterable: true,<br />
                sortable: true,<br />
                pageable: true,<br />
                autorowheight: true,<br />
                altrows: true,<br />
                columnsresize: true,<br />
                columns: [<br />
                  { text: ‘Supplier Name’, cellsalign: ‘center’, align: ‘center’, datafield: ‘SupplierName’, width: 110 },<br />
                  { text: ‘Name’, columngroup: ‘ProductDetails’, cellsalign: ‘center’, align: ‘center’, datafield: ‘ProductName’, width: 120 },<br />
                  { text: ‘Quantity’, columngroup: ‘ProductDetails’, datafield: ‘Quantity’, cellsformat: ‘d’, cellsalign: ‘center’, align: ‘center’, width: 80 },<br />
                  { text: ‘Freight’, columngroup: ‘OrderDetails’, datafield: ‘Freight’, cellsformat: ‘d’, cellsalign: ‘center’, align: ‘center’, width: 100 },<br />
                  { text: ‘Order Date’, columngroup: ‘OrderDetails’, cellsalign: ‘center’, align: ‘center’, cellsformat: ‘d’, datafield: ‘OrderDate’, width: 100 },<br />
                  { text: ‘Order Address’, columngroup: ‘OrderDetails’, cellsalign: ‘center’, align: ‘center’, datafield: ‘OrderAddress’, width: 100 },<br />
                  { text: ‘Price’, columngroup: ‘ProductDetails’, datafield: ‘Price’, cellsformat: ‘c2′, align: ‘center’, cellsalign: ‘center’, width: 70 },<br />
                  { text: ‘Address’, columngroup: ‘Location’, cellsalign: ‘center’, align: ‘center’, datafield: ‘Address’, width: 120 },<br />
                  { text: ‘City’, columngroup: ‘Location’, cellsalign: ‘center’, align: ‘center’, datafield: ‘City’, width: 80 }<br />
                ],<br />
                columngroups:<br />
                [<br />
                  { text: ‘Product Details’, align: ‘center’, name: ‘ProductDetails’ },<br />
                  { text: ‘Order Details’, parentgroup: ‘ProductDetails’, align: ‘center’, name: ‘OrderDetails’ },<br />
                  { text: ‘Location’, align: ‘center’, name: ‘Location’ }<br />
                ]<br />
            });<br />
            $(“#excelExport”).jqxButton({ theme: theme });<br />
            $(“#xmlExport”).jqxButton({ theme: theme });<br />
            $(“#csvExport”).jqxButton({ theme: theme });<br />
            $(“#tsvExport”).jqxButton({ theme: theme });<br />
            $(“#htmlExport”).jqxButton({ theme: theme });<br />
            $(“#jsonExport”).jqxButton({ theme: theme });<br />
            $(“#excelExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘xls’, ‘jqxGrid’);<br />
            });<br />
            $(“#xmlExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘xml’, ‘jqxGrid’);<br />
            });<br />
            $(“#csvExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘csv’, ‘jqxGrid’);<br />
            });<br />
            $(“#tsvExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘tsv’, ‘jqxGrid’);<br />
            });<br />
            $(“#htmlExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘html’, ‘jqxGrid’);<br />
            });<br />
            $(“#jsonExport”).click(function () {<br />
                $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘json’, ‘jqxGrid’);<br />
            });<br />
            $(“#print”).jqxButton();<br />
            $(“#print”).click(function () {<br />
                var gridContent = $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘html’);<br />
                var newWindow = window.open(”, ”, ‘width=800, height=500′),<br />
                document = newWindow.document.open(),<br />
                pageContent =<br />
                    ‘&lt;!DOCTYPE html&gt;\n’ +<br />
                    ‘&lt;html&gt;\n’ +<br />
                    ‘&lt;head&gt;\n’ +<br />
                    ‘&lt;meta charset=”utf-8″ /&gt;\n’ +<br />
                    ‘&lt;title&gt;jQWidgets Grid&lt;/title&gt;\n’ +<br />
                    ‘&lt;/head&gt;\n’ +<br />
                    ‘&lt;body&gt;\n’ + gridContent + ‘\n&lt;/body&gt;\n&lt;/html&gt;’;<br />
                document.write(pageContent);<br />
                document.close();<br />
                newWindow.print();<br />
            });<br />
         });<br />
    &lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body class=‘default’&gt;<br />
    &lt;div id=‘jqxWidget’ style=“font-size: 13px; font-family: Verdana; float: left;”&gt;<br />
        &lt;div id=“jqxgrid”&gt;&lt;/div&gt;<br />
        &lt;div style=‘margin-top: 20px;’&gt;<br />
            &lt;div style=‘float: left;’&gt;<br />
                &lt;input type=“button” value=“Export to Excel” id=‘excelExport’ /&gt;<br />
                &lt;br /&gt;&lt;br /&gt;<br />
                &lt;input type=“button” value=“Export to XML” id=‘xmlExport’ /&gt;<br />
            &lt;/div&gt;<br />
            &lt;div style=‘margin-left: 10px; float: left;’&gt;<br />
                &lt;input type=“button” value=“Export to CSV” id=‘csvExport’ /&gt;<br />
                &lt;br /&gt;&lt;br /&gt;<br />
                &lt;input type=“button” value=“Export to TSV” id=‘tsvExport’ /&gt;<br />
            &lt;/div&gt;<br />
            &lt;div style=‘margin-left: 10px; float: left;’&gt;<br />
                &lt;input type=“button” value=“Export to HTML” id=‘htmlExport’ /&gt;<br />
                &lt;br /&gt;&lt;br /&gt;<br />
                &lt;input type=“button” value=“Export to JSON” id=‘jsonExport’ /&gt;<br />
            &lt;/div&gt;<br />
            &lt;div style=‘margin-left: 10px; float: left;’&gt;<br />
                &lt;input type=“button” value=“Print” id=‘print’ /&gt;<br />
            &lt;/div&gt;<br />
        &lt;/div&gt;<br />
    &lt;/div&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
[/html]</p>
<p>That is all. We have successfully created a wonderful JQX Grid as in the following:</p>
<div id="attachment_8991" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality1.jpg"><img decoding="async" aria-describedby="caption-attachment-8991" src="http://sibeeshpassion.com/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality1.jpg" alt="Advanced JQX Grid With All Functionality" width="650" height="528" class="size-full wp-image-8991" srcset="/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality1.jpg 439w, /wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality1-300x244.jpg 300w, /wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality1-400x325.jpg 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-8991" class="wp-caption-text">Advanced JQX Grid With All Functionality</p></div>
<div id="attachment_9001" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality2.jpg"><img decoding="async" aria-describedby="caption-attachment-9001" src="http://sibeeshpassion.com/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality2.jpg" alt="Advanced JQX Grid With All Functionality" width="650" height="536" class="size-full wp-image-9001" srcset="/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality2.jpg 433w, /wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality2-300x247.jpg 300w, /wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality2-400x330.jpg 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-9001" class="wp-caption-text">Advanced JQX Grid With All Functionality</p></div>
<div id="attachment_9011" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality3.jpg"><img decoding="async" aria-describedby="caption-attachment-9011" src="http://sibeeshpassion.com/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality3.jpg" alt="Advanced JQX Grid With All Functionality" width="650" height="530" class="size-full wp-image-9011" srcset="/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality3.jpg 438w, /wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality3-300x245.jpg 300w, /wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality3-400x326.jpg 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-9011" class="wp-caption-text">Advanced JQX Grid With All Functionality</p></div>
<p>Now you may think, why are those export buttons outside? It looks different, right? Now we can work on it. In the JQX Grid there is an option called showtoolbar, by setting this to true we can have a toolbar along with the grid. There we can bind all of these buttons if you want. So shall we start?<br />
[js]<br />
showtoolbar: true,<br />
[/js]</p>
<p>Add that line to your JQX grid implementation. Next we need to append the UI elements to the tool bar, right?<br />
[js]<br />
rendertoolbar:function (toolbar) {<br />
                                     var me = this;<br />
                                     var container = $(“&lt;div &gt;&lt;/div&gt;”);<br />
                                     var input = $(‘&lt;div id=”excelExport” style=”background-color: #555555;float: left; font-<br />
                                                    weight: bold;line-height: 28px; min-<br />
                                                    width: 80px;padding: 3px 5px 3px 10px;color: #fff; “&gt;Excel&lt;/div&gt;<br />
                                                    div style=”background-color: #555555;float: left; font-weight: bold;line-<br />
                                                    height: 28px; min-width: 80px;padding: 3px 5px 3px 10px;color: #fff; margin-<br />
                                                    left: 3px;” id=”print” &gt;Print&lt;/div&gt;&lt;/div&gt;’);<br />
                                     toolbar.append(container);<br />
                                     container.append(input);<br />
                                 }<br />
[/js]</p>
<p>Add the preceding function also. 🙂 Now this is how your JQX Grid Implementation must be:<br />
[js]<br />
$(“#jqxgrid”).jqxGrid(<br />
                        {<br />
                            width: 900,<br />
                            source: dataAdapter,<br />
                            filterable: true,<br />
                            sortable: true,<br />
                            pageable: true,<br />
                            autorowheight: true,<br />
                            altrows: true,<br />
                            columnsresize: true,<br />
                            showtoolbar: true,<br />
                            rendertoolbar: function (toolbar) {<br />
                            var me = this;<br />
                            var container = $(“&lt;div &gt;&lt;/div&gt;”);<br />
                            var input = $(‘&lt;div id=”div1″ style=”background-color: #555555;float: left; font-weight: bold;line-<br />
                                          height: 28px; min-width: 80px;padding: 3px 5px 3px 10px;color: #fff; “&gt;Your First Div&lt;/div&gt;<br />
                                          &lt;div style=”background-color: #555555;float: left; font-weight: bold;line-height: 28px; min-<br />
                                          width: 80px;padding: 3px 5px 3px 10px;color: #fff; margin-<br />
                                          left: 3px;” id=”Div2″ &gt;Your Second Div&lt;/div&gt;&lt;/div&gt;’);<br />
                           toolbar.append(container);<br />
                           container.append(input);<br />
                      },<br />
                columns: [<br />
                           { text: ‘Supplier Name’, cellsalign: ‘center’, align: ‘center’, datafield: ‘SupplierName’, width: 110 },<br />
                           { text: ‘Name’, columngroup: ‘ProductDetails’, cellsalign: ‘center’, align: ‘center’, datafield: ‘ProductName’<br />
                             , width: 120 },<br />
                           { text: ‘Quantity’, columngroup: ‘ProductDetails’, datafield: ‘Quantity’, cellsformat: ‘d’, cellsalign: ‘cente<br />
                             r’, align: ‘center’, width: 80 },<br />
                           { text: ‘Freight’, columngroup: ‘OrderDetails’, datafield: ‘Freight’, cellsformat: ‘d’, cellsalign: ‘center’,<br />
                             align: ‘center’, width: 100 },<br />
                           { text: ‘Order Date’, columngroup: ‘OrderDetails’, cellsalign: ‘center’, align: ‘center’, cellsformat: ‘d’, da<br />
                             tafield: ‘OrderDate’, width: 100 },<br />
                           { text: ‘Order Address’, columngroup: ‘OrderDetails’, cellsalign: ‘center’, align: ‘center’, datafield: ‘Order<br />
                             Address’, width: 100 },<br />
                           { text: ‘Price’, columngroup: ‘ProductDetails’, datafield: ‘Price’, cellsformat: ‘c2′, align: ‘center’, cellsa<br />
                             lign: ‘center’, width: 70 },<br />
                           { text: ‘Address’, columngroup: ‘Location’, cellsalign: ‘center’, align: ‘center’, datafield: ‘Address’, width<br />
                             : 120 },<br />
                           { text: ‘City’, columngroup: ‘Location’, cellsalign: ‘center’, align: ‘center’, datafield: ‘City’, width: 80 }<br />
                         ],<br />
           columngroups: [<br />
                           { text: ‘Product Details’, align: ‘center’, name: ‘ProductDetails’ },<br />
                           { text: ‘Order Details’, parentgroup: ‘ProductDetails’, align: ‘center’, name: ‘OrderDetails’ },<br />
                           { text: ‘Location’, align: ‘center’, name: ‘Location’ }<br />
                         ]<br />
         });<br />
[/js]</p>
<p>Now your output looks like the following:</p>
<div id="attachment_9021" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality4.jpg"><img decoding="async" aria-describedby="caption-attachment-9021" src="http://sibeeshpassion.com/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality4.jpg" alt="Advanced JQX Grid With All Functionality" width="650" height="522" class="size-full wp-image-9021" srcset="/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality4.jpg 445w, /wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality4-300x241.jpg 300w, /wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality4-400x321.jpg 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-9021" class="wp-caption-text">Advanced JQX Grid With All Functionality</p></div>
<p>What if you want to share this Grid with your friends? For that we have a jQuery share pluggin, <a href="http://www.jqueryscript.net/social-media/Minimal-jQuery-Plugin-For-Social-Share-Buttons-Sharer.html" target="_blank">Minimal jQuery Plugin For Social Share Buttons – Sharer</a>.</p>
<p><strong>Include the following files from the downloded rar from the preceding link</strong></p>
<li>jquery.sharer.css</li>
<li>jquery.sharer.js</li>
<li>sharer.png</li>
<p>[js]<br />
&lt;link href=“styles/jquery.sharer.css” rel=“stylesheet” type=“text/css” /&gt;<br />
&lt;script src=“scripts/jquery.sharer.js” type=“text/javascript”&gt;&lt;/script&gt;<br />
[/js]</p>
<p><strong>Include the script to your page</strong><br />
[js]<br />
$(“.social-buttons”).sharer();<br />
[/js]</p>
<p><strong>Add a div where you can see the share buttons</strong><br />
[js]<br />
&lt;div class=“social-buttons” style=“position: relative;z-index: 1000;”&gt;&lt;/div&gt;<br />
[/js]</p>
<p>Well, that’s all; you have now done everything. We can now see the page as,</p>
<div id="attachment_9031" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality5.jpg"><img decoding="async" aria-describedby="caption-attachment-9031" src="http://sibeeshpassion.com/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality5.jpg" alt="Advanced JQX Grid With All Functionality" width="650" height="478" class="size-full wp-image-9031" srcset="/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality5.jpg 485w, /wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality5-300x221.jpg 300w, /wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality5-400x294.jpg 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-9031" class="wp-caption-text">Advanced JQX Grid With All Functionality</p></div>
<p>To set the page size add the following line to your grid settings:<br />
[js]<br />
pagesize: 50,<br />
[/js]</p>
<p>To set the custom pagesize options add the following line to your grid settings:<br />
[js]<br />
pagesizeoptions: [‘5′,’10’,’15’,’20’,’30’,’40’,’50’],<br />
[/js]</p>
<p>To allow resizing of the columns add the following line to your grid settings:<br />
[js]<br />
columnsresize: true,<br />
[/js]</p>
<p>To allow column re-ordering options add the following line to your grid settings:</p>
<p>[js]<br />
columnsreorder: true,<br />
[/js]</p>
<p>Be sure that you added the <em>jqxgrid.columnsreorder.js</em> JavaScript file.</p>
<p>To allow an Excel-like filter add the following line to your grid settings:<br />
[js]<br />
filtermode: ‘excel’,<br />
[/js]</p>
<p>Then you will get a filtering option as follows:</p>
<div id="attachment_9041" style="width: 660px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality6.jpg"><img decoding="async" aria-describedby="caption-attachment-9041" src="http://sibeeshpassion.com/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality6.jpg" alt="Advanced JQX Grid With All Functionality" width="650" height="407" class="size-full wp-image-9041" srcset="/wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality6.jpg 570w, /wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality6-300x188.jpg 300w, /wp-content/uploads/2014/10/advanced-jqx-grid-with-all-functionality6-400x250.jpg 400w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-9041" class="wp-caption-text">Advanced JQX Grid With All Functionality</p></div>
<p>To enable the tooltip add the following line to your grid settings<br />
[js]<br />
enabletooltips: true,<br />
[/js]</p>
<p>To apply themes add the following line to your grid settings<br />
[js]<br />
theme: ‘metro’,<br />
[/js]</p>
<p>Please be noted that you must include the style sheet accordingly, In this case you have to include the following<br />
[html]<br />
&lt;link href=“~/jqwidgets/styles/jqx.metro.css” rel=“stylesheet” /&gt;<br />
[/html]</p>
<p>You can find so many CSS in <em>jqwidgets/styles</em> folder.</p>
<p>To enable auto height add the following line to your grid settings<br />
[js]<br />
autoheight: true,<br />
[/js]</p>
<p>To show the default filter icon always add the following line to your grid settings<br />
[js]<br />
autoshowfiltericon: false,<br />
[/js]</p>
<p>Happy Coding 🙂</p>
<p><strong>History</strong></p>
<p>First Version: 20-Oct-2014<br />
Second Version: 23-Oct-2014</p>
<p><strong>Conclusion</strong></p>
<p>Did I miss anything that you may think which is needed? Could you find this post as useful? I hope you liked this article. Please share me your valuable suggestions and feedback.</p>
<p><strong>Your turn. What do you think?</strong></p>
<p>A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/advanced-jqx-grid-with-all-functionality/feed/</wfw:commentRss>
			<slash:comments>10</slash:comments>
		
		
			</item>
	</channel>
</rss>
