Class: soby_WebGrid

<section><header>

soby_WebGrid

</header> <article>

new soby_WebGrid(contentDivSelector, title, dataService, emptyDataHtml)

Represents a webgrid.
Parameters:
Name Type Description
contentDivSelector string The author of the book.
title string The title of the grid.
dataService string The dataservice of the grid.
emptyDataHtml string Html content which will be displayed if there is no record.
Source:
Example
// Creates the grid object
var bookDataSourceBuilder = new soby_WSBuilder();
bookDataSourceBuilder.Filters = new SobyFilters(false);
bookDataSourceBuilder.AddSchemaField("Id", SobyFieldTypes.Number, null);
bookDataSourceBuilder.AddSchemaField("Title", SobyFieldTypes.Text, null);
bookDataSourceBuilder.AddSchemaField("Year", SobyFieldTypes.Number, null);
bookDataSourceBuilder.AddSchemaField("Price", SobyFieldTypes.Number, null);
bookDataSourceBuilder.AddSchemaField("Genre", SobyFieldTypes.Text, null);
bookDataSourceBuilder.AddSchemaField("AuthorId", SobyFieldTypes.Lookup, { ModelName: "Author", ValueFieldType: SobyFieldTypes.Number, ValueFieldName: "Id", TitleFieldName: "Name", ReadTransport: new soby_TransportRequest(soby_GetTutorialWebAPIUrl() + "/Authors", "json", "application/json; charset=utf-8", "GET")});
var bookService = new soby_WebServiceService(bookDataSourceBuilder);
bookService.Transport.Read = new soby_TransportRequest(soby_GetTutorialWebAPIUrl() + "/Books", "json", "application/json; charset=utf-8", "GET");
bookService.Transport.Add = new soby_TransportRequest(soby_GetTutorialWebAPIUrl() + "/Books", "json", "application/json; charset=utf-8", "POST");
bookService.Transport.Update = new soby_TransportRequest(soby_GetTutorialWebAPIUrl() + "/Books(#key)", "json", "application/json; charset=utf-8", "PUT");
bookService.Transport.Delete = new soby_TransportRequest(soby_GetTutorialWebAPIUrl() + "/Books(#key)", "json", "application/json; charset=utf-8", "DELETE");
var bookGrid = new soby_WebGrid("#soby_BooksDiv", "Books", bookService, "There is no record found.");
bookGrid.ImagesFolderUrl = "/Images";
bookGrid.AddKeyField("Id");
bookGrid.AddColumn("Title", "Title", SobyShowFieldsOn.All, null, null, true, true, true, null);
bookGrid.AddColumn("Year", "Year", SobyShowFieldsOn.All, null, null, true, true, true, null);
bookGrid.AddColumn("Price", "Price", SobyShowFieldsOn.All, null, null, true, true, true, null);
bookGrid.AddColumn("Genre", "Genre", SobyShowFieldsOn.All, null, null, true, true, true, null);
bookGrid.AddColumn("AuthorId", "Author", SobyShowFieldsOn.All, function (item) {
   return item.Author.Name;
}, null, true, true, true, null);
bookGrid.Initialize(true);

Members

ActionInProgress

Properties:
Name Type Description
ActionInProgress boolean States whether an action is in progress or not.
Active boolean States whether the grid is active or not.
CellCount number Total cell count.
Columns Array Columns of the grid.
ContentDivSelector string Jquery selector sring for the grid main container.
DataRelations Array Relations with other grids.
DataService soby_ServiceInterface The service to provide data to the grid.
DisplayTitle boolean States whether it should display the title or not.
EmptyDataHtml string The html content which will be displayed when there is no record in the grid result.
Filters SobyFilters Filters of the grid.
FilterControls Array Controls for filter fields.
GridID string ID string of the grid.
GroupByFields SobyGroupByFields Group by fields.
ImagesFolderUrl string Url of the grid images folder.
IsSelectable boolean States whether rows should be selectable or not.
IsEditable boolean States whether rows should be editable or not.
IsGroupable boolean States whether fields should be groupable or not.
ItemDialogClientID string Client id of the item (edit/new) dialog.
Items Array Populated items of the grid.
KeyFields Array.<string> Key fields.
OrderByFields SobyOrderByFields Order by fields.
PageIndex number Index of the current page.
ShowHeader boolean States whether headers should be visible or not.
Title string Title of the grid.
Source:

Methods

Activate()

Activates the grid.
Source:
Example
// Activates the grid
grid.Activate();

AddColumn()

Adds a column
Source:
Example
// Adds Title as a column
grid.AddColumn("Title", "Title", SobyShowFieldsOn.All, null, null, true, true, true, null);

AddDataRelation()

Adds a data relation
Source:
Example
// Adds a data relation on Id field with AuthorId on detail grid
authorGrid.AddDataRelation("Title", "Id", authorBooksGrid.GridID, "AuthorId");

AddFilterControl()

Not implemented yet.
Source:

AddHeaderCell()

Adds a header cell
Source:

AddKeyField()

Adds key field.
Source:
Example
// Adds ID as key field
grid.AddKeyField("ID");

AllowDropColumn()

Allows drop column
Source:

ApplyFilters()

Apply filters
Source:
Example
// Apply filters
grid.ApplyFilters('Title');

ClearFiltersOn()

Clear filters on given field name
Source:
Example
// Clear filters on given field name
grid.ClearFiltersOn('Title')

DeActivate()

De-activates the grid.
Source:
Example
// De-Activates the grid
grid.Activate();

DeleteSelectedRows()

Deletes selected rows.
Source:
Example
// Deletes selected rows
grid.DeleteSelectedRows();

DragColumn()

Drags column via setting its field name
Source:

DropColumn()

Drops the column
Source:

DropGroupByColumn()

Drops group by column
Source:

EditCell()

Not implemented yet.
Source:

EditNewRow()

Edits new row.
Source:
Example
// Edits new row.
grid.EditNewRow();

EditOffCell()

Not implemented yet.
Source:

EditOffOnEditedCells()

Not implemented yet.
Source:

EditSelectedCell()

Not implemented yet.
Source:

EditSelectedRow()

Edits selected row.
Source:
Example
// Edits selected row.
grid.EditSelectedRow();

EnsureGridExistency()

Ensures grid is in the global grid array.
Source:
Example
// Ensures grid is in the global grid array.
grid.EnsureGridExistency();

EnsureItemDialogContainer()

Ensures edit/new item form dialog exists in the body.
Source:
Example
// Ensures edit/new item form dialog exists in the body.
grid.EnsureItemDialogContainer(1, 'Title');

FilterResult()

Filters result based on given field name with single value
Source:
Example
// Filters the result with the given value
grid.FilterResult('Title', 'Moby', SobyFieldTypes.Text, SobyFilterTypes.Contains)

FilterResultWithMultipleValues()

Filters result based on given field name with multiple value
Source:
Example
// Filters the result with the given values
grid.FilterResultWithMultipleValues('Title', ['Moby', 'Don'], SobyFieldTypes.Text, SobyFilterTypes.Contains)

GenerateActionPane()

Generates action pane
Source:
Example
// Generates action pane
grid.GenerateActionPane();

GenerateFilterPane()

Generates filter pane
Source:
Example
// Generates filter pane
grid.GenerateFilterPane();

GenerateGroupByPanePane()

Generates group by pane
Source:
Example
// Generates filter pane
grid.GenerateGroupByPanePane();

GenerateNavigationPane()

Generates navigation pane
Source:
Example
// Generates navigation pane
grid.GenerateNavigationPane();

GetActiveRowID()

Gets active row identifier
Source:
Example
// returns "soby_griddatarow_bbe4e9e8-6e44-aca8-0129-15fc255df0ec"
grid.GetActiveRowID()

GetItemFieldValue()

Get the value of the given rowindex and fieldname.
Source:
Example
// Returns the value of Title field which is in row with index number 1.
grid.GetItemFieldValue(1, 'Title');

GetRowIds()

Gets row identifiers
Source:
Example
// returns ["soby_griddatarow_bbe4e9e8-6e44-aca8-0129-15fc255df0ec", "soby_griddatarow_f0b7f7e8-6b89-accf-0446-88eda73e0bee"]
grid.GetRowIds()

GetSelectedCellID()

Gets selected cell identifier
Source:
Example
// returns "soby_gridcell_8be81bcb-ae80-5309-3d8a-6ad091c01051"
grid.GetSelectedCellID();

GetSelectedDataItems()

Gets selected data items
Source:
Example
// returns [Object, Object]
grid.GetSelectedDataItems();

GetSelectedRowID()

Gets selected row identifier
Source:
Example
// returns "soby_griddatarow_bbe4e9e8-6e44-aca8-0129-15fc255df0ec"
grid.GetSelectedRowID()

GetSelectedRowIDs()

Gets selected row identifiers
Source:
Example
// returns ["soby_griddatarow_fa5a2dd6-fc2a-d61b-5b9f-4e6e0824ce11", "soby_griddatarow_fdc30fcf-caee-eec7-a95f-16589d619c9c"]
grid.GetSelectedRowIDs();

GoToNextPage()

Navigates to the next page
Source:
Example
// Navigates to the next page
grid.GoToNextPage();

GoToPreviousPage()

Navigates to the previous page
Source:
Example
// Navigates to the previous page
grid.GoToPreviousPage();

GroupBy()

Groups result based on given field name
Source:
Example
// Group by Title field as ascending
grid.GroupBy('Title', true)

HideCellPopupContent()

Hides cell poup content
Source:
Example
// Hides cell poup content
grid.HideCellPopupContent('soby_gridcell_2e7e2471-cd48-85ac-45ab-5f2db8162cbc')

HideHeaderRowMenu()

Hides header row menu
Source:
Example
// Hides header row menu icon
grid.HideHeaderRowMenu('Title');

HideHeaderRowMenuIcon()

Hides header row menu icon
Source:
Example
// Hides header row menu icon
grid.HideHeaderRowMenuIcon('Title');

HideItemDialog()

Hides edit/new item form dialog.
Source:
Example
// Hides edit/new item form dialog.
grid.HideItemDialog();

HideShowFilterPane()

Hides/show filter pane
Source:
Example
// Hides/show filter pane
grid.HideShowFilterPane();

Initialize()

Initializes the grid
Source:
Example
// Initializes the grid and populate items
grid.Initialize(true);

PopulateDetailGrid()

Populates the detail grid
Source:
Example
// Populates the detail grid
grid.PopulateDetailGrid('soby_grid_fc073155-7f8d-094a-4745-55acd12c4812','#soby_griddatarow_e63bc6df-9a42-a52e-86a5-3d6665cd0bc0_soby_grid_fc073155-7f8d-094a-4745-55acd12c4812', 'soby_griddatarow_e63bc6df-9a42-a52e-86a5-3d6665cd0bc0', 'AuthorId', '1');

PopulateEditControlsOnNewEditForm()

Populate edit controls for edit/new item form.
Source:
Examples
// Populates new item form
grid.PopulateEditControlsOnNewEditForm(false, null);
// Populates edit item form for row id as soby_griddatarow_e6d7a5b4-3636-5780-f02e-c84b43ca2c6b
grid.PopulateEditControlsOnNewEditForm(true, 'soby_griddatarow_e6d7a5b4-3636-5780-f02e-c84b43ca2c6b');

PopulateGridData()

Populates the grid data
Source:
Example
// Populates the grid with the given items
grid.PopulateGridData(items);

PopulateHeaderCells()

Populates header cells
Source:
Example
// Populates header cells
grid.PopulateHeaderCells()

SaveItemDetail()

Saves currently edited item.
Source:
Example
// Saves edited item with row id as soby_griddatarow_e6d7a5b4-3636-5780-f02e-c84b43ca2c6b.
grid.SaveItemDetail('soby_griddatarow_e6d7a5b4-3636-5780-f02e-c84b43ca2c6b');

SelectCell()

Selects the cell
Source:
Example
// Selects the cell with given row identifier and cell index
grid.SelectCell("soby_griddatarow_fdc30fcf-caee-eec7-a95f-16589d619c9c", 3);

SelectDetailGridTab()

Selects the detail grid tab
Source:
Example
// Populates the detail grid
grid.SelectDetailGridTab('soby_griddatarow_e63bc6df-9a42-a52e-86a5-3d6665cd0bc0', '0');

SelectRow()

Selects the row
Source:
Example
// Selects the row with given row identifier
grid.SelectRow("soby_griddatarow_fdc30fcf-caee-eec7-a95f-16589d619c9c");

ShowCellPopupContent()

Shows cell poup content
Source:
Example
// Shows cell poup content
grid.ShowCellPopupContent('soby_gridcell_2e7e2471-cd48-85ac-45ab-5f2db8162cbc')

ShowHeaderRowMenu()

Shows header row menu
Source:
Example
// Shows header row menu
grid.ShowHeaderRowMenu('Title', 'Title', true, true)

ShowHeaderRowMenuIcon()

Shows header row menu icon
Source:
Example
// Shows header row menu icon
grid.ShowHeaderRowMenuIcon('Title');

SortGroupByField()

Sorts result based on given group by field name
Source:
Example
// Sorts by Title group field as ascending
grid.SortGroupByField('Title', true)

SortResult()

Sorts result based on given field name
Source:
Example
// Sorts by Title field as ascending
grid.SortResult('Title', true)

Events

ItemCreated

Item creation event.
Type:
  • object
Properties:
Name Type Description
rowID object Identifier of the row.
item object Data item related with the row.
Source:

OnCellSelected

Cell selection event.
Type:
  • object
Properties:
Name Type Description
grid soby_WebGrid Current grid object.
rowID object Identifier of the row.
cellIndex object Index of the cell.
Source:

OnGridPopulated

Grid population event.
Type:
  • object
Source:

OnRowSelected

Row selection event.
Type:
  • object
Source:
</article> </section>
<nav>

Home

Classes

Events

</nav>
<footer>Documentation generated by JSDoc 3.4.0 on Mon Aug 22 2016 17:14:16 GMT+0300 (GTB Summer Time)</footer>

Last edited Aug 22, 2016 at 3:27 PM by Serkant_Samurkas, version 2