Hi Guys,
I created a application which uses the following components, layout, grid, datastore, dataprocessor, and in the backend im using django to do the bulk of the work… i have my components connected as follows:
The datastore is synced with the grid, and the dataprocessor is init’d to the datastore.,
the issue i am facing is that
-
I create a new item in the datastore for the first time it works great, but when i create another item (without saveData for the first one) in the datastore it creates the item & the row in the grid but adds a dummy row which is un-selectable., it gets worse if i add a third item to the store it adds a item & two dummy items in the grid., and this keeps happening till i refresh the page, then the whole thing starts again.
-
The edits made to the newly added row are not marked by the dataProcessor, even if it marks the row when i sendData it doesn’t generate a request
i’m having to reload all data on the page once something changes to cope with this… can some one tell me what i’m doing wrong
# grids init
root.inv_grid = root.layout1.cells("a").attachGrid()
root.inv_grid.enableMultiselect(false)
root.inv_grid.setDateFormat("%Y-%m-%d")
root.inv_grid.init()
root.inv_form = root.layout1.cells("b").attachForm()
root.wa_li_grid = root.layout2.cells("a").attachGrid()
root.wa_li_grid.enableMultiselect(true)
root.wa_li_grid.setDateFormat("%Y-%m-%d")
root.wa_li_grid.init()
root.avial_shots_grid = root.layout2.cells("b").attachGrid()
root.avial_shots_grid.enableMultiselect(true)
root.avial_shots_grid.setDateFormat("%Y-%m-%d")
root.avial_shots_grid.init()
# datastores
root.invoices_ds = new dhtmlXDataStore()
root.lineitems_ds = new dhtmlXDataStore()
root.avial_shots_ds = new dhtmlXDataStore()
root.companies_ds = new dhtmlXDataStore()
root.shows_ds = new dhtmlXDataStore()
# load the grids & form
root.inv_grid.loadXML("/static/Fintab/INV/xml/grids/config_inv_grid.xml")
root.inv_form.loadStruct("/static/Fintab/INV/xml/forms/config_inv_form.xml")
root.inv_form.bind(root.inv_grid)
root.wa_li_grid.loadXML("/static/Fintab/INV/xml/grids/config_inv_li_grid.xml")
root.avial_shots_grid.loadXML("/static/Fintab/INV/xml/grids/config_inv_li_grid.xml")
load_datastores = ->
# invoices datastore events, actions
root.invoices_ds.load(
"/populate_ds/invoice/#{root.active_only}",
"json",
->
root.invoices_ds.filter(
(obj, value) ->
if obj.status isnt "Void"
true
else
false
)
root.inv_grid.sync(root.invoices_ds)
root.inv_form.bind(root.inv_grid)
root.layout1.cells("a").progressOff()
root.layout1.cells("b").progressOff()
)
#invoice items datastore init, events, actions
root.lineitems_ds.load(
"/populate_ds/invoice_lineitem/#{root.active_only}",
"json",
->
root.wa_li_grid.sync(root.lineitems_ds)
root.layout2.cells("a").progressOff()
)
# Dataprocessor for invoices
root.invoice_dp = new dataProcessor("/crud/Invoice/")
root.invoice_dp.setUpdateMode("off")
root.invoice_dp.setTransactionMode('POST', true)
root.invoice_dp.enableDataNames(true)
root.invoice_dp.init(root.invoices_ds)
# events
root.invoice_dp.attachEvent('onBeforeDataSending', (id) ->
root.main_layout.progressOn()
true
)
root.invoice_dp.attachEvent('onFullSync', ->
root.main_layout.progressOff()
true
)
Each code block is in a separate function block, and called in a logical order when the page loads using the
dhtmlxEvent window, "load", function