Prepopulate Expression Grid with partially populated rows
Ideally I need to be able to do this:
- Load metadata with connection string
- Automatically add specific table to query builder
- Populate Expression Grid with rows that have no expression, but with Alias (Column name) populated. This list is unrelated to the table selected.
The idea is to help the user by supplying all aliases that will be needed instead of having them type them manually.
I looked in examples such as AlternateNames, but the rows added are related to the table selected.
Is there a way to do this?
Thank you,
Simon
Thank you for all the answers but unfortunately it's still not working.
The alias column (I assume that is "Column Name") is not a combo box.
This is the code I am using. I modified the Default.aspx file of the "Client event handle" sample:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Samples.Default" %> <%@ Register TagPrefix="uc" TagName="QueryBuilderUC" Src="ClientEventHandle.ascx" %> <!DOCTYPE html> <html> <head id="Head1" runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>ActiveQueryBilder ASP.NET - Simple Offline Demo</title> <link href="jquery.jgrowl.css" type="text/css" rel="stylesheet" /> <style type="text/css"> </style> </head> <body> <script type="text/javascript" language="javascript" src="jquery.jgrowl.js"></script> <script type="text/javascript" language="javascript"> //OnApplicationReady(function () { // QB.Web.Application.Canvas.bind(QB.Web.Canvas.Events.CanvasOnAddTable, onAddTableToCanvas); // QB.Web.Core.bind(QB.Web.Core.Events.DataSending, beforeDataExchange); // QB.Web.Core.bind(QB.Web.Core.Events.DataReceived, afterDataExchange); //}); OnApplicationReady(function () { QB.Web.Application.GridComponent.CustomEditControl = function (key, cell, row) { var control = null; if (key == MetaData.FieldParamType.alias) { var values = ["alias1", "alias2", "alias3", "alias4"]; control = $('<select>'); values.forEach(function (val, i) { $('<option value="' + val + '">' + val + '</option>').appendTo(control); }) } return control; } }); function beforeDataExchange(e, data) { $.jGrowl("Before data exchange", { header: 'Core event' }); } function afterDataExchange(e, data) { $.jGrowl("After data exchange", { header: 'Core event' }); } function onAddTableToCanvas(sender, e) { $.jGrowl("Add table to canvas", { header: 'Canvas event' }); } </script> <form id="Form1" runat="server"> <uc:QueryBuilderUC ID="QueryBuilderUC1" runat="server" /> </form> </body> </html>