Skip to content

Commit c23f8f2

Browse files
committed
Reskin header
Add getting started example Move other stuff to secondary pages
1 parent 06f3c6b commit c23f8f2

File tree

13 files changed

+358
-108
lines changed

13 files changed

+358
-108
lines changed

Griddly/Content/Site.css

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,23 @@ input[type="checkbox"].input-validation-error {
8888
box-shadow: 2px 2px 3px #6e6e6e;
8989
color: #e2e2e2;
9090
display: block;
91-
font: 1.5em 'andale mono','lucida console',monospace;
92-
line-height: 1.5em;
91+
font: 1.4em 'andale mono','lucida console',monospace;
92+
line-height: 1.4em;
9393
overflow: auto;
9494
padding: 15px
95+
}
96+
97+
.syntaxhighlighter
98+
{
99+
overflow-y:hidden !important;
100+
padding: 10px 20px;
101+
margin: 0 0 20px;
102+
font-size: .8em !important;
103+
line-height: 1.25em !important;
104+
border-left: 5px solid #eee;
105+
}
106+
107+
.syntaxhighlighter .line
108+
{
109+
line-height: 1.25em !important;
95110
}

Griddly/Content/griddly-128.png

14.3 KB
Loading

Griddly/Content/griddly-192.png

40.6 KB
Loading

Griddly/Controllers/HomeController.cs

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,11 @@ public GriddlyResult FilterListGrid()
9292

9393
public ActionResult About()
9494
{
95-
ViewBag.Message = "Your application description page.";
96-
9795
return View();
9896
}
9997

100-
public ActionResult Contact()
98+
public ActionResult Examples()
10199
{
102-
ViewBag.Message = "Your contact page.";
103-
104100
return View();
105101
}
106102

@@ -130,5 +126,68 @@ static List<TestGridItem> BuildTestData()
130126

131127
return items;
132128
}
129+
130+
public ActionResult IndexGrid(string item, int? quantityStart, int? quantityEnd, decimal? totalStart, decimal? totalEnd, string firstName, string lastName, bool? isApproved)
131+
{
132+
this.SetGriddlyDefault(ref isApproved, "isApproved", true);
133+
134+
IQueryable<SimpleOrder> query = _indexTestData;
135+
136+
if (!string.IsNullOrWhiteSpace(item))
137+
query = query.Where(x => x.Item.ToLower().Contains(item.ToLower()));
138+
139+
if (quantityStart != null && quantityEnd != null)
140+
query = query.Where(x => x.Quantity >= quantityStart && x.Quantity <= quantityEnd);
141+
if (quantityStart != null)
142+
query = query.Where(x => x.Quantity >= quantityStart);
143+
if (quantityEnd != null)
144+
query = query.Where(x => x.Quantity <= quantityEnd);
145+
146+
if (totalStart != null && totalEnd != null)
147+
query = query.Where(x => x.Total >= totalStart && x.Total <= totalEnd);
148+
if (totalStart != null)
149+
query = query.Where(x => x.Total >= totalStart);
150+
if (totalEnd != null)
151+
query = query.Where(x => x.Total <= totalEnd);
152+
153+
if (!string.IsNullOrWhiteSpace(firstName))
154+
query = query.Where(x => x.Person.FirstName.ToLower().Contains(firstName.ToLower()));
155+
if (!string.IsNullOrWhiteSpace(lastName))
156+
query = query.Where(x => x.Person.LastName.ToLower().Contains(lastName.ToLower()));
157+
158+
if (isApproved != null)
159+
query = query.Where(x => x.IsApproved == isApproved);
160+
161+
return new GriddlyResult<SimpleOrder>(query);
162+
}
163+
164+
static readonly IQueryable<SimpleOrder> _indexTestData = BuildIndexTestData().ToList().AsQueryable();
165+
166+
static IEnumerable<SimpleOrder> BuildIndexTestData()
167+
{
168+
List<SimpleOrder> items = new List<SimpleOrder>();
169+
170+
Random r = new Random();
171+
172+
int count = r.Next(10000);
173+
174+
for (int i = 0; i < count; i++)
175+
{
176+
yield return new SimpleOrder()
177+
{
178+
Id = i,
179+
Item = Lorem.GetWord(),
180+
Quantity = 1 + r.Next(10),
181+
Total = 1 + (decimal)(r.NextDouble() * 10000),
182+
IsApproved = r.Next(10) > 3,
183+
Person = new SimplePerson()
184+
{
185+
Id = r.Next(10000),
186+
FirstName = Name.GetFirstName(),
187+
LastName = Name.GetLastName(),
188+
}
189+
};
190+
}
191+
}
133192
}
134193
}

Griddly/Griddly.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@
128128
<DependentUpon>Global.asax</DependentUpon>
129129
</Compile>
130130
<Compile Include="Models\Enums.cs" />
131+
<Compile Include="Models\SimplePerson.cs" />
132+
<Compile Include="Models\SimpleOrder.cs" />
131133
<Compile Include="Models\TestGridItem.cs" />
132134
<Compile Include="Properties\AssemblyInfo.cs" />
133135
</ItemGroup>
@@ -231,7 +233,7 @@
231233
<Content Include="Views\Shared\Error.cshtml" />
232234
<Content Include="Views\Shared\_Layout.cshtml" />
233235
<Content Include="Views\Home\About.cshtml" />
234-
<Content Include="Views\Home\Contact.cshtml" />
236+
<Content Include="Views\Home\Examples.cshtml" />
235237
<Content Include="Views\Home\Index.cshtml" />
236238
<Content Include="Views\Shared\Griddly\BootstrapButton.cshtml" />
237239
<Content Include="Views\Shared\Griddly\ButtonStrip.cshtml" />
@@ -242,6 +244,7 @@
242244
<Content Include="Views\Home\FilterBoxGrid.cshtml" />
243245
<Content Include="Views\Home\FilterListGrid.cshtml" />
244246
<Content Include="_AppStart.cshtml" />
247+
<Content Include="Views\Home\IndexGrid.cshtml" />
245248
</ItemGroup>
246249
<ItemGroup>
247250
<ProjectReference Include="..\Griddly.Mvc\Griddly.Mvc.csproj">

Griddly/Models/SimpleOrder.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace Griddly.Models
2+
{
3+
public class SimpleOrder
4+
{
5+
public int Id { get; set; }
6+
public string Item { get; set; }
7+
public int Quantity { get; set; }
8+
public decimal Total { get; set; }
9+
public bool IsApproved { get; set; }
10+
public SimplePerson Person { get; set; }
11+
}
12+
}

Griddly/Models/SimplePerson.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+

2+
namespace Griddly.Models
3+
{
4+
public class SimplePerson
5+
{
6+
public int Id { get; set; }
7+
public string FirstName { get; set; }
8+
public string LastName { get; set; }
9+
}
10+
}

Griddly/Views/Home/About.cshtml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
@{
22
ViewBag.Title = "About";
33
}
4-
<h2>@ViewBag.Title.</h2>
5-
<h3>@ViewBag.Message</h3>
6-
7-
<p>Use this area to provide additional information.</p>
4+
<div class="row">
5+
<div class="col-md-12">
6+
<h2>@ViewBag.Title</h2>
7+
<p>After researching all of the ASP.NET MVC grid components like <a href="http://msdn.microsoft.com/en-us/library/system.web.helpers.webgrid(v=vs.111).aspx">WebGrid</a> and the Javascript grid components like <a href="http://www.datatables.net/">DataTables</a>, I found them all lacking – either the grid is rendered on the server and is kludgy or its rendered client only giving an extra request on page load. Data and render logic is tightly coupled, etc.</p>
8+
<p>Griddly solves those problems by separating render and data logic, rendering in page during the first render, then requesting subsequent pages from the same MVC action method using a hybrid approach.</p>
9+
<p>Griddly is built to be extremely configurable, end to end, from data source to rendering. You can use the default IQueryable data source or write your own. There are default template hooks for most things you would want to change. If not, let us know and we’ll add what you need.</p>
10+
<p>The default UI is rendered using <a href="http://getbootstrap.com">Bootstrap 3</a>, but you can add templates for whatever UI framework you use.</p>
11+
</div>
12+
</div>

Griddly/Views/Home/Contact.cshtml

Lines changed: 0 additions & 17 deletions
This file was deleted.

Griddly/Views/Home/Examples.cshtml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
@{
2+
ViewBag.Title = "Samples";
3+
}
4+
<div class="row">
5+
<div class="col-md-12">
6+
<h2>@ViewBag.Title</h2>
7+
@Html.Griddly("FilterBoxGrid", new { test = SortDirection.Ascending })
8+
<br />
9+
<a href="javascript:GetFilterValues()">get filter values</a> | <a href="javascript:SetFilterValues()">set filter values</a>
10+
@Html.Griddly("FilterRangeGrid")
11+
<br />
12+
@Html.Griddly("FilterListGrid")
13+
<br />
14+
@Html.Griddly("TestGrid")
15+
</div>
16+
</div>
17+
<script>
18+
function AlertSelectedIds(rowIds)
19+
{
20+
var result = $(this).closest(".griddly").griddly("getSelected", rowIds);
21+
22+
var str = "{\n";
23+
for (var k in result)
24+
str += " " + k + " : [ " + result[k].toString() + " ]\n";
25+
str += "}";
26+
27+
alert(str);
28+
}
29+
30+
function GetFilterValues()
31+
{
32+
var result = $(".filter-range-grid").griddly("getFilterValues");
33+
34+
var str = "{\n";
35+
for (var k in result)
36+
str += " " + k + " : [ " + result[k].toString() + " ]\n";
37+
str += "}";
38+
39+
alert(str);
40+
}
41+
42+
function SetFilterValues()
43+
{
44+
$(".filter-range-grid").griddly("setFilterValues", { companyStart: '53' });
45+
}
46+
</script>
47+
48+
@section scripts{
49+
<script>
50+
//$(".test-grid").on("beforerefresh.griddly", function ()
51+
//{
52+
// alert("It's not minty fresh!");
53+
// return false;
54+
//});
55+
</script>
56+
}

0 commit comments

Comments
 (0)