Grid and Editing

Hello,

i wanna know, how the editing function of the grid works. I can’t find any example in the documentation.

My syntax is:

[code]dhx.ui({
id:“herstellerWin”,
view:“window”,
width:470,
height:400,

head:{ view:"toolbar", type:"SubBar", data:[
		{ type:"button", label:"Neu", click:"", align:"left" },
		{ type:"button", label:"Umbenennen", click:"", align:"left" },
		{ type:"button", label:"Löschen", click:"deleteHersteller()", align:"left" },
		{ type:"button", label:"Abbrechen", click:"$$('herstellerWin').close()", align:"right" }
]},
modal:true,
body: {
	view:"grid",
	id:"herstellerGrid",
	select: "true",
	edit:"true",
	sorting:"true",
	fields:[
		
		{
			id:"name",
			width:460,
			label:"Hersteller",
			sort:{
				as:"string"
			}
		},
	
	],
	datatype:"json", url:"send.php?c=ghl"
}

});
[/code]

Thanks in advance
Horst Muerdter
CrossData-Tools

Hello,

grid doesn’t provide functionality for built-in editing. However, you may use form for editing. You may show form on “onItemClick” event or any other action and path grid data into this form. After editing is finished, the grid item can be refreshed:

$$(“herstellerGrid”).item(itemId).name = $$(“yourForm”).getValues()[“name”];
$$(“herstellerGrid”).refresh(itemId);

The new version, which is going to be released this month, will provide a “bind” feature - the easy way to link grid or list with a form.

Hello Alexandra

thank you for your answer.

The documentation for the grid mention the editAbility as included into the grid component. If no inline editing is supported o planned (btw, it’s a great pity), can the editAbility used to something similiar ?

Thanks in advance
Horst Muerdter
CrossData-Tools

If you are plan to use dhtlmxTouch for the phone or other small screen device - inline editing is not the best solution - it is much less usefull than separate form views.

Check the attached sample., it requires just a few lines of code to link form to the grid.
gridform.zip (79.9 KB)

Hello Stanislav,

thank you for the example.

I’ve tried to implement the example in a modal window with the following code. But it doesn’t work :blush:

Any idea?

[code] dhx.ui({
cells:[
{
id:“herstellerWin”,
view:“window”,
width:470,
height:400,

			head:{ view:"toolbar", type:"SubBar", data:[
					{ type:"button", label:"Neu", click:"newHersteller()", align:"left" },
					{ type:"button", label:"Umbenennen", click:"renameHersteller()", align:"left" },
					{ type:"button", label:"Löschen", click:"deleteHersteller()", align:"left" },
					{ type:"button", label:"Abbrechen", click:"$$('herstellerWin').close()", align:"right" }
			]},
			modal:true,
			body: {
				view:"grid",
				id:"herstellerGrid",
				fields:[
					{
						id:"name",
						width:470,
						label:"Hersteller",
						sort:{
							as:"string"
						}
					}

				],
				datatype:"json", url:"send.php?c=ghl"
			}
		},
		{
			view:"form",
			id:"herstellerForm",
			elements:[
				{ view:"button", label:"Save", id:"saveButton" },
				{ view:"button", label:"Abbrechen", id:"cancelButton" },
				{ view:"text", label:"Hersteller", name:"name" }
			]
		}
	]
});
[/code]

Thank you in advance

Horst Muerdter
CrossData-Tools

The code in the sample uses updated codebase , which will be published as dhtmlx touch 1.0 ( hopefully till the end of this week )

If you are using codebase from the sample, replace in your code
type:“button”,
with
view:“button”,

and
view:“toolbar”, type:“SubBar”, data:[
with
view:“toolbar”, type:“SubBar”, elements:[

Hello Stanislav,

thank you for your comment. Is it posible to get the new sources before oficial release to terminate our proyect?

Thanks in advance

Horst Mürdter
CrossData-Tools

Yep, drop an email to the support@dhtmlx.com with a reference to this post.