Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Audit DataSources not accessible in application

    Hi,
    I am working on SmartGWT Enterprise Edition version "12.1-p20200926".
    I was trying the audit data sources and for the same made the following DS:
    Code:
    <DataSource ID="XYZSQL"
                serverType="sql"
                tableName="XYZ"
                audit="true"
                xmlns:fmt="WEB-INF/">
        <fmt:bundle basename="DSMessages"/>
        <fields>
            <field name="xyz_id" type="sequence" hidden="true" primaryKey="true"/>
            <field name="xyz_type_id" type="integer" foreignKey="CdSQL.cd_id" joinType="outer" required="true"/>
            <field name="company_id" type="text" length="36" foreignKey="CompanySQL.company_id" required="true"/>
            <field name="name" type="text" length="100" required="true">
                <title>
                    <fmt:message key="name"/>
                </title>
            </field>
            <field name="address1" type="text" length="35">
                <title>
                    <fmt:message key="address1"/>
                </title>
            </field>
            <field name="address2" type="text" length="35">
                <title>
                    <fmt:message key="address2"/>
                </title>
            </field>
            <field name="address3" type="text" length="35">
                <title>
                    <fmt:message key="address3"/>
                </title>
            </field>
            <field name="city" type="text" length="35">
                <title>
                    <fmt:message key="city"/>
                </title>
            </field>
            <field name="state" type="text" length="2">
                <title>
                    <fmt:message key="state"/>
                </title>
            </field>
            <field name="zip" type="text" length="10">
                <title>
                    <fmt:message key="zip"/>
                </title>
            </field>
            <field name="country" type="text" length="50">
                <title>
                    <fmt:message key="country"/>
                </title>
            </field>
            <field name="phone" type="text" length="30">
                <title>
                    <fmt:message key="phone"/>
                </title>
            </field>
            <field name="fax" type="text" length="30">
                <title>
                    <fmt:message key="fax"/>
                </title>
            </field>
            <field name="email" type="text" length="100">
                <title>
                    <fmt:message key="email"/>
                </title>
            </field>
    
        </fields>
    </DataSource>

    As per the documentation, A new DB table with the name "audit_XYZSQL" was created and all the changes done to audited ListGrid (with DS XYZSQL) are being persisted in the audit DB table.

    When I try to fetch the ds by simple
    Code:
    final DataSource ds = DataSource.get("audit_XYZSQL");
    , it always returns null. Also, I am trying to use "audit_XYZSQL" as a DS in my seperate ListGrid, but the fetch operation on audit ListGrid is not working stating
    No DataSource or invalid DataSource specified, can't create data model
    .

    I can see my audit Datasource under the Datasources tab of Admin console (under the option All data sources). It is not shown under "Application Datasources.

    Please help me with how can I access the audit datasource as a normal datasource in my application.

    Please let me know in case more details are required.
    Last edited by sidharth1917; 12th Oct 2020, 06:57.

    #2
    You're not loading the audit DataSource, so just load it via the normal process (DataSourceLoader tag or DataSource.load()).

    Audit DataSources are not automatically loaded along with the DataSource being audited.

    Comment


      #3
      Hi,
      Thank you for the quick response.
      In the showcase source code though, the audit data source is never loaded explicitly. In the Index.html, only the audited DS is loaded. Please refer: https://www.smartclient.com/smartgwt...case/#auditing.

      If I go by the showcase, do you think I should be loading the DS explicitly?

      Regards.

      Comment


        #4
        You are not correctly looking at how the Showcase does things - each sample's dependencies are dynamic.

        So by the docs, and what we're re-affirming here: you need to load the DataSource.

        Comment

        Working...
        X