문제

who knows a way to create a custom cell fora dojox.grid.DataGrid? I of course could use the get and formatter properties of the layout, but this is not a really reusable solution!

Thanks for your input!

heinrich

도움이 되었습니까?

해결책

You can try an indirect way to add a dojo widget to a grid cell

1) Set escapeHTMLInData to false for the dojox.grid.DataGrid

2) Then in the get/formatter function try something like

function formatterFn() {
    var buttonToReturn = dijit.form.Button({
        /* Button attributes */
    }
    var div = document.createElement("div");
    div.appendChild(buttonToReturn.domNode);
    return div.innerHTML;
    // You can leave the div orphan
}

You can conditionally return different widgets to suit your needs

Hope it helps!

다른 팁

What do you mean by custom cell?

Do you want to use check box or textbox instead of text? or

Do you want to show images instead of text?

In the first case

  • give 'editable'="true"
  • set 'singleClickEdit'= "true" and
  • set cellType variable. You can extend the default editor class and make your own editor class.

In the second case you can use the formatter function.

It is better to use the existing functions and classes. Extending will make the grid slower.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top