<commit_before>{% load dojango_base %}
{% load dojango_filters %}
{% set_dojango_context %}

{# TODO: Add a css loader to the dojo collector #}
<link rel="stylesheet"
        href="{{ DOJANGO.DOJOX_URL }}/grid/resources/{{ DOJANGO.THEME }}Grid.css"
        type="text/css" />

<script type="text/javascript">
if(typeof(dojango) == 'undefined') dojango= {};
if(typeof(dojango._datagrid) == 'undefined') dojango._datagrid= {};
if(typeof(dojango._datagrid._stores) == 'undefined') dojango._datagrid._stores= {};

function {{id}}_noSort(row){ return !(false {{ nosort }}); }
dojo.addOnLoad(function(){ 
    dojango._datagrid._stores.{{id}}=new dojox.data.QueryReadStore({ url: {{ json_store_url|json|safe }} });
    var {{id}}_layout=[
    {% for x in headers %}
        {
            field:"{{x.attname}}", 
            name:"{{x.label|safe|capfirst}}",
            width: "{{x.width}}" 
            {% if x.formatter %}, formatter: {{x.formatter}} {% endif %}
        }{% if not forloop.last %},{% endif %}
    {% endfor %}
    ];
    dojango._datagrid.{{id}}= new dojox.grid.DataGrid({
        jsid:'{{id}}',
        id:'{{id}}',
        store:dojango._datagrid._stores.{{id}}, 
        structure:{{id}}_layout,
        canSort:{{id}}_noSort
        {% if query %},query:{{query|safe}}{% endif %}
   }, dojo.place(dojo.create("div"), dojo.byId("{{id}}_container")));
   dojango._datagrid.{{id}}.startup();
});

{% if search_fields %}
var dojango._datagrid.{{id}}_last = "";
function do_{{id}}_search(el) {
    if (el.value != dojango._datagrid.{{id}}_last) {
        dojango._datagrid.{{id}}_last = el.value;

        dojango._datagrid.{{id}}.filter({
            search:el.value, 
            search_fields:'{{search_fields}}'
            {% for k, v in query.items %},'{{k}}':'{{v}}'{% endfor %} 
        }, true);
    }
}
{% endif %}
</script>
{% if search_fields %}<div style="width:{{width}};height:20px" >&nbsp;Search:<input style="border:solid 1px #ccc;margin-left:10px" type=text onkeyup="do_{{id}}_search(this)"/></div>{% endif %}
<div id="{{id}}_container" style="width:{{width}}; height:{{height}}"></div><commit_msg>live search was broken with namespace change<commit_after>{% load dojango_base %}
{% load dojango_filters %}
{% set_dojango_context %}

{# TODO: Add a css loader to the dojo collector #}
<link rel="stylesheet"
        href="{{ DOJANGO.DOJOX_URL }}/grid/resources/{{ DOJANGO.THEME }}Grid.css"
        type="text/css" />

<script type="text/javascript">
if(typeof(dojango) == 'undefined') dojango= {};
if(typeof(dojango._datagrid) == 'undefined') dojango._datagrid= {};
if(typeof(dojango._datagrid._stores) == 'undefined') dojango._datagrid._stores= {};

function {{id}}_noSort(row){ return !(false {{ nosort }}); }
dojo.addOnLoad(function(){ 
    dojango._datagrid._stores.{{id}}=new dojox.data.QueryReadStore({ url: {{ json_store_url|json|safe }} });
    var {{id}}_layout=[
    {% for x in headers %}
        {
            field:"{{x.attname}}", 
            name:"{{x.label|safe|capfirst}}",
            width: "{{x.width}}" 
            {% if x.formatter %}, formatter: {{x.formatter}} {% endif %}
        }{% if not forloop.last %},{% endif %}
    {% endfor %}
    ];
    dojango._datagrid.{{id}}= new dojox.grid.DataGrid({
        jsid:'{{id}}',
        id:'{{id}}',
        store:dojango._datagrid._stores.{{id}}, 
        structure:{{id}}_layout,
        canSort:{{id}}_noSort
        {% if query %},query:{{query|safe}}{% endif %}
   }, dojo.place(dojo.create("div"), dojo.byId("{{id}}_container")));
   dojango._datagrid.{{id}}.startup();
});

{% if search_fields %}
dojango._datagrid.{{id}}_last = "";
function do_{{id}}_search(el) {
    if (el.value != dojango._datagrid.{{id}}_last) {
        dojango._datagrid.{{id}}_last = el.value;

        dojango._datagrid.{{id}}.filter({
            search:el.value, 
            search_fields:'{{search_fields}}'
            {% for k, v in query.items %},'{{k}}':'{{v}}'{% endfor %} 
        }, true);
    }
}
{% endif %}
</script>
{% if search_fields %}<div style="width:{{width}};height:20px" >&nbsp;Search:<input style="border:solid 1px #ccc;margin-left:10px" type=text onkeyup="do_{{id}}_search(this)"/></div>{% endif %}
<div id="{{id}}_container" style="width:{{width}}; height:{{height}}"></div>
{'fraction_non_alphanumeric': 0.22331231020789535, 'fraction_numerical': 0.00233590282644242, 'mean_word_length': 3.565031982942431, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2492660', 'n_tokens_mistral': 1563, 'n_tokens_neox': 1460, 'n_words': 240}