g1 issueshttps://code.gramener.com/cto/g1/-/issues2018-11-24T09:00:01Zhttps://code.gramener.com/cto/g1/-/issues/115g1 template should support list creation2018-11-24T09:00:01ZS Anandg1 template should support list creation### Summary
`$().template()` replaces the target DOM element. Allow it to append to the target DOM element.
### Benefits
This helps in creating lists that can be extended. For example:
- Repeated AJAX loads append data to the target ...### Summary
`$().template()` replaces the target DOM element. Allow it to append to the target DOM element.
### Benefits
This helps in creating lists that can be extended. For example:
- Repeated AJAX loads append data to the target node
- Successive notifications can be appended to the target node
### Usage
`$().template({}, {append: true})` should enable this behavior.1.46S AnandS Anandhttps://code.gramener.com/cto/g1/-/issues/107Trigger simple hashchange events2018-11-16T14:40:57ZS AnandTrigger simple hashchange events### Summary
When the URL hash changes, trigger a `#?key` event on the window.
### Benefits
This makes it easier for developers to write URL-driven applications.
To change state, just add `<a href="#?key=val" class="urlfilter" data-ta...### Summary
When the URL hash changes, trigger a `#?key` event on the window.
### Benefits
This makes it easier for developers to write URL-driven applications.
To change state, just add `<a href="#?key=val" class="urlfilter" data-target="#">`
To respond to state, don't use `$('a').on('click')`. Instead, use `$(window).on('#?key')`.
### Usage
For example, if the URL changes from `/page` to `/page#?state=Goa`, you can listen to `$(window).on('#?state', function(state) { ... })` will be triggered with `Goa` as the `state`.
It will also trigger `$(window).on('#?', function(url) { ... })` where `url` is a g1 parsed URL.
To enable this, just run `$(window).urlchange(options)`.
Instead of `window`, we can run this on iframes and any other urlfilter target too.1.46S AnandS Anandhttps://code.gramener.com/cto/g1/-/issues/131FormHandler add does not show dropdowns while FormHandler edit does2019-01-25T08:13:24ZS AnandFormHandler add does not show dropdowns while FormHandler edit doesRaised by @sindhura.ch
When using a select for specific columns (see code below):
```yaml
columns: [
{ name: '*' },
{
name: 'user_designation',
editable: {
input: 'select',
...Raised by @sindhura.ch
When using a select for specific columns (see code below):
```yaml
columns: [
{ name: '*' },
{
name: 'user_designation',
editable: {
input: 'select',
options: ['ACMO', 'CDO']
}
},
{ name: 'user_password', hide: true },
{ name: 'actions', template: $('#action-template').html() }
]
```
... the dropdown is visible when we click **Edit** but not when we click **Add**. See screenshots below.
![image](/uploads/b7a550001240a215be070f84c5692499/image.png)
![image](/uploads/794eb9caf9244ff28351c9617fa2c8e0/image.png)TejeshTejeshhttps://code.gramener.com/cto/g1/-/issues/125Implement a FormHandler form editor2019-02-07T10:42:47ZS AnandImplement a FormHandler form editorAllow users to design a form that updates a single row. Use this to
- edit rows
- as a modal, a separate section, or as an iframe
- rapidly flip between rows using submit / keyboard navigation
- learn from data already typed to ease the...Allow users to design a form that updates a single row. Use this to
- edit rows
- as a modal, a separate section, or as an iframe
- rapidly flip between rows using submit / keyboard navigation
- learn from data already typed to ease the process of filling the form
- support automated columns (e.g. updated time, editor)https://code.gramener.com/cto/g1/-/issues/6$().formhandler column formatting2018-03-06T07:11:43ZS Anand$().formhandler column formatting```html
<div src="formhandler" class="formhanlder">
<script>
$('.formhandler').formhandler({
// - `columns`: comma-separated column names to display, or a list of objects with these keys:
// - `name`: column name
// - `title`: d...```html
<div src="formhandler" class="formhanlder">
<script>
$('.formhandler').formhandler({
// - `columns`: comma-separated column names to display, or a list of objects with these keys:
// - `name`: column name
// - `title`: display name of the column. Defaults to the same value as `name`
// - `type`: `text` (default) / `number` / 'date'. Determines filters to be used
// - `format`: string / function. Functions are applied to the value and the return value is used. Strings are treated as:
// - a numeral.js format for number (numeral.js must be loaded by the developer)
// - a moment.js format for date (moment.js must be loaded by the developer)
// - `sort`: `true` / `false` / operators dict with:
// - `{'': 'Sort ascending', '-': 'Sort descending'}` (default)
// - `filters`: `true` (default) / `false` / operators dict with:
// - `{'', 'Equals...', '!', 'Does not equal...', ...}`.
// The default list of operators is based on the auto-detected type of the column.
// - `unique`: TODO: {dict of query parameter and display value} or [list of values] or function?
// - `hideable`: `true` (default) / `false`
columns: [
{name: 'ID', title: '#', type: 'text', sort: true, filters: true, hideable: true},
{name: 'c1', title: 'Red', type: 'number', sort: true, filters: true, hideable: true},
{
name: 'Name',
title: 'Name',
format: 'text',
sort: {
'': 'Sort alphabetically', // Only allow sort ascending
},
filters: {
'': 'Equals...',
'!': 'Does not equal...',
'~': 'Contains...',
'!~': 'Does not contain...'
},
hideable: false // Cannot hide this column from the UI
}
],
{
name: 'Symbols',
type: 'text',
format: function(val) { return val === null ? '' : val } // Disallow NaN
},
{
name: 'c8',
type: 'number',
format: '0,0.0' // Interpreted as a numeraljs format
}
})
```
Note: When the operators are clicked, a dialog box should pop up like at https://learn.gramener.com/guide/formhandler/flags?_format=table
Use a template for this - just like the other components.TejeshTejesh